CPPLapack
|
Samll Real Double-precision Symmetric Matrix Class. More...
#include <dsymatrix_small.hpp>
Public Member Functions | |
dsymatrix_small () | |
dsymatrix_small (const dsymatrix &) | |
dsymatrix_small (const double &) | |
~dsymatrix_small () | |
dgematrix_small< n, n > | to_dgematrix_small () const |
dsymatrix | to_dsymatrix () const |
double & | operator() (const long &i, const long &j) |
double | operator() (const long &i, const long &j) const |
dsymatrix_small< n > & | set (const long &, const long &, const double &) |
void | read (const char *filename) |
void | write (const char *filename) const |
dsymatrix_small< n > & | zero () |
dsymatrix_small< n > & | identity () |
template<long N> | |
dsymatrix_small< N > & | operator= (const dsymatrix_small< N > &) |
Public Attributes | |
double | array [(n *(n+1))/2] |
Friends | |
template<long _n> | |
std::ostream & | operator<< (std::ostream &, const dsymatrix_small< _n > &) |
template<long N> | |
dsymatrix_small< N > & | operator+= (dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dsymatrix_small< N > & | operator-= (dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dsymatrix_small< N > & | operator*= (dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dsymatrix_small< N > & | operator*= (dsymatrix_small< N > &, const double &) |
template<long N> | |
dsymatrix_small< N > & | operator/= (dsymatrix_small< N > &, const double &) |
template<long N> | |
const dsymatrix_small< N > & | operator+ (const dsymatrix_small< N > &) |
template<long N> | |
dsymatrix_small< N > | operator- (const dsymatrix_small< N > &) |
template<long N> | |
dgematrix_small< N, N > | operator+ (const dsymatrix_small< N > &, const dgematrix_small< N, N > &) |
template<long N> | |
dsymatrix_small< N > | operator+ (const dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dgematrix_small< N, N > | operator- (const dsymatrix_small< N > &, const dgematrix_small< N, N > &) |
template<long N> | |
dsymatrix_small< N > | operator- (const dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dcovector_small< N > | operator* (const dsymatrix_small< N > &, const dcovector_small< N > &) |
template<long N> | |
dgematrix_small< N, N > | operator* (const dsymatrix_small< N > &, const dgematrix_small< N, N > &) |
template<long N> | |
dgematrix_small< N, N > | operator* (const dsymatrix_small< N > &, const dsymatrix_small< N > &) |
template<long N> | |
dsymatrix_small< N > | operator* (const dsymatrix_small< N > &, const double &) |
template<long N> | |
dsymatrix_small< N > | operator/ (const dsymatrix_small< N > &, const double &) |
template<long N> | |
dsymatrix_small< N > | operator* (const double &, const dsymatrix_small< N > &) |
Samll Real Double-precision Symmetric Matrix Class.
Definition at line 3 of file dsymatrix_small.hpp.
dsymatrix_small< n >::dsymatrix_small | ( | ) | [inline] |
Definition at line 4 of file dsymatrix_small-constructors.hpp.
{VERBOSE_REPORT; ; }
dsymatrix_small< n >::dsymatrix_small | ( | const dsymatrix & | mat | ) | [inline, explicit] |
Definition at line 12 of file dsymatrix_small-constructors.hpp.
References dsymatrix::array, dsymatrix::m, and dsymatrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( n!=mat.n ){ ERROR_REPORT; std::cerr << "Matrix sizes must be the same." << std::endl << "Your input was " << n << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long k=0; k<(n*(n+1))/2; k++){ array[k] =mat.array[k];; } }
dsymatrix_small< n >::dsymatrix_small | ( | const double & | x | ) | [inline] |
Definition at line 31 of file dsymatrix_small-constructors.hpp.
{VERBOSE_REPORT; for(long k=0; k<(n*(n+1))/2; k++){ array[k] =x; } }
dsymatrix_small< n >::~dsymatrix_small | ( | ) | [inline] |
Definition at line 45 of file dsymatrix_small-constructors.hpp.
{VERBOSE_REPORT; ; }
dgematrix_small< n, n > dsymatrix_small< n >::to_dgematrix_small | ( | ) | const [inline] |
dsymatrix dsymatrix_small< n >::to_dsymatrix | ( | ) | const [inline] |
double & dsymatrix_small< n >::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
double dsymatrix_small< n >::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
dsymatrix_small< n > & dsymatrix_small< n >::set | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
Definition at line 72 of file dsymatrix_small-functions.hpp.
References i().
{VERBOSE_REPORT; (*this)(i,j)=v; return *this; }
void dsymatrix_small< n >::read | ( | const char * | filename | ) | [inline] |
Definition at line 115 of file dsymatrix_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 != "dsymatrix" && id != "#dsymatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not dsymatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } long _n; s >> _n; if(n!=_n){ ERROR_REPORT; std::cerr << "Matrix size is invalid." << std::endl; exit(1); } for(long i=0; i<n; i++){ for(long j=0; j<=i; 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 a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; exit(1); } s.close(); }
void dsymatrix_small< n >::write | ( | const char * | filename | ) | const [inline] |
Definition at line 95 of file dsymatrix_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 << "#dsymatrix" << " " << n << std::endl; for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ ofs << operator()(i,j) << " "; } ofs << std::endl; } ofs.close(); }
dsymatrix_small< n > & dsymatrix_small< n >::zero | ( | ) | [inline] |
dsymatrix_small< n > & dsymatrix_small< n >::identity | ( | ) | [inline] |
Definition at line 179 of file dsymatrix_small-functions.hpp.
{VERBOSE_REPORT; zero(); for(long k=0; k<n; k++){ (*this)(k,k) =1.; } return *this; }
dsymatrix_small<N>& dsymatrix_small< n >::operator= | ( | const dsymatrix_small< N > & | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | , |
const dsymatrix_small< _n > & | |||
) | [friend] |
dsymatrix_small<N>& operator+= | ( | dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dsymatrix_small<N>& operator-= | ( | dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dsymatrix_small<N>& operator*= | ( | dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dsymatrix_small<N>& operator*= | ( | dsymatrix_small< N > & | , |
const double & | |||
) | [friend] |
dsymatrix_small<N>& operator/= | ( | dsymatrix_small< N > & | , |
const double & | |||
) | [friend] |
const dsymatrix_small<N>& operator+ | ( | const dsymatrix_small< N > & | ) | [friend] |
dsymatrix_small< N > operator- | ( | const dsymatrix_small< N > & | ) | [friend] |
dgematrix_small<N,N> operator+ | ( | const dsymatrix_small< N > & | , |
const dgematrix_small< N, N > & | |||
) | [friend] |
dsymatrix_small< N > operator+ | ( | const dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dgematrix_small<N,N> operator- | ( | const dsymatrix_small< N > & | , |
const dgematrix_small< N, N > & | |||
) | [friend] |
dsymatrix_small< N > operator- | ( | const dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dcovector_small< N > operator* | ( | const dsymatrix_small< N > & | , |
const dcovector_small< N > & | |||
) | [friend] |
dgematrix_small<N,N> operator* | ( | const dsymatrix_small< N > & | , |
const dgematrix_small< N, N > & | |||
) | [friend] |
dgematrix_small<N,N> operator* | ( | const dsymatrix_small< N > & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
dsymatrix_small< N > operator* | ( | const dsymatrix_small< N > & | , |
const double & | |||
) | [friend] |
dsymatrix_small< N > operator/ | ( | const dsymatrix_small< N > & | , |
const double & | |||
) | [friend] |
dsymatrix_small< N > operator* | ( | const double & | , |
const dsymatrix_small< N > & | |||
) | [friend] |
double dsymatrix_small< n >::array[(n *(n+1))/2] |
Definition at line 9 of file dsymatrix_small.hpp.
Referenced by operator*(), operator+=(), and operator-=().