CPPLapack
|
Samll Real Double-precision General Dence Matrix Class. More...
#include <dgematrix_small.hpp>
Public Member Functions | |
dgematrix_small () | |
dgematrix_small (const dgematrix &) | |
dgematrix_small (const double &) | |
~dgematrix_small () | |
_dgematrix | to_dgematrix () const |
double & | operator() (const long &i, const long &j) |
double | operator() (const long &i, const long &j) const |
dgematrix_small< m, n > & | set (const long &i, const long &j, const double &v) |
void | read (const char *filename) |
void | write (const char *filename) const |
dgematrix_small< m, n > & | zero () |
dgematrix_small< m, n > & | identity () |
dcovector_small< m > | col (const long &j) const |
drovector_small< n > | row (const long &i) const |
template<long M, long N> | |
dgematrix_small< M, N > & | operator= (const dgematrix_small< M, N > &) |
Public Attributes | |
double | array [m *n] |
Friends | |
template<long _m, long _n> | |
std::ostream & | operator<< (std::ostream &, const dgematrix_small< _m, _n > &) |
template<long _m, long _n> | |
dgematrix_small< n, m > | t (const dgematrix_small< m, n > &) |
template<long M, long N> | |
dgematrix_small< M, N > & | operator+= (dgematrix_small< M, N > &, const dgematrix_small< M, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > & | operator-= (dgematrix_small< M, N > &, const dgematrix_small< M, N > &) |
template<long M, long L, long N> | |
dgematrix_small< M, N > & | operator*= (dgematrix_small< M, L > &, const dgematrix_small< L, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > & | operator*= (dgematrix_small< M, N > &, const double &) |
template<long M, long N> | |
dgematrix_small< M, N > & | operator/= (dgematrix_small< M, N > &, const double &) |
template<long M, long N> | |
const dgematrix_small< M, N > & | operator+ (const dgematrix_small< M, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator- (const dgematrix_small< M, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator+ (const dgematrix_small< M, N > &, const dgematrix_small< M, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator+ (const dgematrix_small< M, N > &, const dsymatrix_small< N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator- (const dgematrix_small< M, N > &, const dgematrix_small< M, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator- (const dgematrix_small< M, N > &, const dsymatrix_small< N > &) |
template<long M, long N> | |
dcovector_small< M > | operator* (const dgematrix_small< M, N > &, const dcovector_small< N > &) |
template<long M, long L, long N> | |
dgematrix_small< M, N > | operator* (const dgematrix_small< M, L > &, const dgematrix_small< L, N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator* (const dgematrix_small< M, N > &, const dsymatrix_small< N > &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator* (const dgematrix_small< M, N > &, const double &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator/ (const dgematrix_small< M, N > &, const double &) |
template<long M, long N> | |
dgematrix_small< M, N > | operator* (const double &, const dgematrix_small< M, N > &) |
Samll Real Double-precision General Dence Matrix Class.
Definition at line 3 of file dgematrix_small.hpp.
dgematrix_small< m, n >::dgematrix_small | ( | ) | [inline] |
Definition at line 4 of file dgematrix_small-constructors.hpp.
{VERBOSE_REPORT; ; }
dgematrix_small< m, n >::dgematrix_small | ( | const dgematrix & | mat | ) | [inline, explicit] |
Definition at line 12 of file dgematrix_small-constructors.hpp.
References dgematrix::array, dgematrix::m, and dgematrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( m!=mat.m || n!=mat.n ){ ERROR_REPORT; std::cerr << "Matrix sizes must be the same." << std::endl << "Your input was " << m << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long k=0; k<m*n; k++){ array[k] =mat.array[k]; } }
dgematrix_small< m, n >::dgematrix_small | ( | const double & | x | ) | [inline] |
Definition at line 31 of file dgematrix_small-constructors.hpp.
{VERBOSE_REPORT; for(long k=0; k<m*n; k++){ array[k] =x; } }
dgematrix_small< m, n >::~dgematrix_small | ( | ) | [inline] |
Definition at line 45 of file dgematrix_small-constructors.hpp.
{VERBOSE_REPORT; ; }
_dgematrix dgematrix_small< m, n >::to_dgematrix | ( | ) | const [inline] |
double & dgematrix_small< m, n >::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
Definition at line 22 of file dgematrix_small-functions.hpp.
double dgematrix_small< m, n >::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
Definition at line 30 of file dgematrix_small-functions.hpp.
dgematrix_small< m, n > & dgematrix_small< m, n >::set | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
Definition at line 38 of file dgematrix_small-functions.hpp.
References i().
{VERBOSE_REPORT; (*this)(i,j) =v; return *this; }
void dgematrix_small< m, n >::read | ( | const char * | filename | ) | [inline] |
Definition at line 82 of file dgematrix_small-functions.hpp.
References i().
{VERBOSE_REPORT; std::ifstream s( filename ); if(!s){ ERROR_REPORT; std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; exit(1); } std::string id; s >> id; if( id != "dgematrix" && id != "#dgematrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not dgematrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } long _m, _n; s >> _m >> _n; if(m!=_m || n!=_n){ ERROR_REPORT; std::cerr << "Matrix size is invalid." << std::endl; exit(1); } for(long i=0; i<m; i++){ for(long j=0; j<n; j++ ){ s >> operator()(i,j); } } if(s.eof()){ ERROR_REPORT; std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; exit(1); } s >> id; if(!s.eof()){ ERROR_REPORT; std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl << "Most likely, there are extra data components." << std::endl; exit(1); } s.close(); }
void dgematrix_small< m, n >::write | ( | const char * | filename | ) | const [inline] |
Definition at line 62 of file dgematrix_small-functions.hpp.
References i().
{VERBOSE_REPORT; std::ofstream ofs(filename, std::ios::trunc); ofs.setf(std::cout.flags()); ofs.precision(std::cout.precision()); ofs.width(std::cout.width()); ofs.fill(std::cout.fill()); ofs << "#dgematrix" << " " << m << " " << n << std::endl; for(long i=0; i<m; i++){ for(long j=0; j<n; j++){ ofs << (*this)()(i,j) << " "; } ofs << std::endl; } ofs.close(); }
dgematrix_small< m, n > & dgematrix_small< m, n >::zero | ( | ) | [inline] |
Definition at line 158 of file dgematrix_small-functions.hpp.
{VERBOSE_REPORT; for(long k=0; k<m*n; k++){ array[k]=0.; } return *this; }
dgematrix_small< m, n > & dgematrix_small< m, n >::identity | ( | ) | [inline] |
Definition at line 167 of file dgematrix_small-functions.hpp.
{VERBOSE_REPORT; zero(); for(long k=0; k<std::min(m,n); k++){ (*this)(k,k)=1.; } return *this; }
dcovector_small< m > dgematrix_small< m, n >::col | ( | const long & | j | ) | const [inline] |
Definition at line 177 of file dgematrix_small-functions.hpp.
References i().
drovector_small< n > dgematrix_small< m, n >::row | ( | const long & | i | ) | const [inline] |
Definition at line 187 of file dgematrix_small-functions.hpp.
References i().
{VERBOSE_REPORT; drovector_small<n> vec; for(long j=0; j<n; j++){ vec(j)=(*this)(i,j); } return vec; }
dgematrix_small<M,N>& dgematrix_small< m, n >::operator= | ( | const dgematrix_small< M, N > & | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | , |
const dgematrix_small< _m, _n > & | |||
) | [friend] |
dgematrix_small<n,m> t | ( | const dgematrix_small< m, n > & | A | ) | [friend] |
Definition at line 140 of file dgematrix_small-functions.hpp.
dgematrix_small<M,N>& operator+= | ( | dgematrix_small< M, N > & | , |
const dgematrix_small< M, N > & | |||
) | [friend] |
dgematrix_small<M,N>& operator-= | ( | dgematrix_small< M, N > & | , |
const dgematrix_small< M, N > & | |||
) | [friend] |
dgematrix_small<M,N>& operator*= | ( | dgematrix_small< M, L > & | , |
const dgematrix_small< L, N > & | |||
) | [friend] |
dgematrix_small<M,N>& operator*= | ( | dgematrix_small< M, N > & | , |
const double & | |||
) | [friend] |
dgematrix_small<M,N>& operator/= | ( | dgematrix_small< M, N > & | , |
const double & | |||
) | [friend] |
const dgematrix_small<M,N>& operator+ | ( | const dgematrix_small< M, N > & | ) | [friend] |
dgematrix_small<M,N> operator- | ( | const dgematrix_small< M, N > & | ) | [friend] |
dgematrix_small<M,N> operator+ | ( | const dgematrix_small< M, N > & | , |
const dgematrix_small< M, N > & | |||
) | [friend] |
dgematrix_small<M,N> operator+ | ( | const dgematrix_small< M, N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dgematrix_small<M,N> operator- | ( | const dgematrix_small< M, N > & | , |
const dgematrix_small< M, N > & | |||
) | [friend] |
dgematrix_small<M,N> operator- | ( | const dgematrix_small< M, N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dcovector_small< M > operator* | ( | const dgematrix_small< M, N > & | , |
const dcovector_small< N > & | |||
) | [friend] |
dgematrix_small<M,N> operator* | ( | const dgematrix_small< M, L > & | , |
const dgematrix_small< L, N > & | |||
) | [friend] |
dgematrix_small<M,N> operator* | ( | const dgematrix_small< M, N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dgematrix_small<M,N> operator* | ( | const dgematrix_small< M, N > & | , |
const double & | |||
) | [friend] |
dgematrix_small<M,N> operator/ | ( | const dgematrix_small< M, N > & | , |
const double & | |||
) | [friend] |
dgematrix_small<M,N> operator* | ( | const double & | , |
const dgematrix_small< M, N > & | |||
) | [friend] |
double dgematrix_small< m, n >::array[m *n] |
Definition at line 9 of file dgematrix_small.hpp.
Referenced by operator*=(), operator+=(), operator-=(), and operator/=().