CPPLapack
|
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage]. More...
#include <dsymatrix.hpp>
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
Definition at line 3 of file dsymatrix.hpp.
dsymatrix::dsymatrix | ( | ) | [inline] |
dsymatrix::dsymatrix | ( | const dsymatrix & | mat | ) | [inline] |
dsymatrix copy constructor
Definition at line 14 of file dsymatrix-constructor.hpp.
dsymatrix::dsymatrix | ( | const _dsymatrix & | mat | ) | [inline] |
dsymatrix constructor to cast _dsymatrix
Definition at line 29 of file dsymatrix-constructor.hpp.
References array, _dsymatrix::array, darray, _dsymatrix::darray, _dsymatrix::n, n, and _dsymatrix::nullify().
dsymatrix::dsymatrix | ( | const long & | _n | ) | [inline] |
dsymatrix copy constructor to cast dssmatrix
dsymatrix constructor to cast _dssmatrix
dsymatrix constructor with size specification
Definition at line 83 of file dsymatrix-constructor.hpp.
References array, darray, i, and n.
: m(n) {VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes must be positive integers. " << std::endl << "Your input was (" << _n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// initialize //////// n =_n; array =new double[n*n]; darray =new double*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*n]; } }
dsymatrix::dsymatrix | ( | const char * | filename | ) | [inline] |
dsymatrix::~dsymatrix | ( | ) | [inline] |
_zhematrix dsymatrix::to_zhematrix | ( | ) | const [inline] |
_dgematrix dsymatrix::to_dgematrix | ( | ) | const [inline] |
convert to _dgematrix
Definition at line 21 of file dsymatrix-cast.hpp.
Referenced by operator+(), and operator-().
_dssmatrix dsymatrix::to_dssmatrix | ( | const double | eps = -1 | ) | const [inline] |
double & dsymatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for non-const object
Definition at line 3 of file dsymatrix-io.hpp.
Referenced by identity(), read(), and write().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || n<=i || n<=j ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if( i >= j ) { //return array[i+n*j]; return darray[j][i]; } else { //return array[j+n*i]; return darray[i][j]; } }
double dsymatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 25 of file dsymatrix-io.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || n<=i || n<=j ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if( i >= j ) { //return array[i+n*j]; return darray[j][i]; } else { //return array[j+n*i]; return darray[i][j]; } }
dsymatrix & dsymatrix::set | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
set value for const object
Definition at line 51 of file dsymatrix-io.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || n<=i || n<=j ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if( i >= j ) { //array[i+n*j] = v; darray[j][i] =v; } else { //array[j+n*i] = v; darray[i][j] =v; } return *this; }
void dsymatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 96 of file dsymatrix-io.hpp.
References i, n, and operator()().
{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(); }
void dsymatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 116 of file dsymatrix-io.hpp.
References i, n, operator()(), and resize().
Referenced by dsymatrix().
{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); } s >> n; resize(n); 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 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 dsymatrix::complete | ( | ) | const [inline] |
void dsymatrix::clear | ( | ) | [inline] |
dsymatrix & dsymatrix::zero | ( | ) | [inline] |
change the matrix into a zero matrix
Definition at line 25 of file dsymatrix-misc.hpp.
Referenced by _dssmatrix::to_dsymatrix(), and dssmatrix::to_dsymatrix().
dsymatrix & dsymatrix::identity | ( | ) | [inline] |
void dsymatrix::chsign | ( | ) | [inline] |
void dsymatrix::copy | ( | const dsymatrix & | mat | ) | [inline] |
make a deep copy of the matrix
Definition at line 51 of file dsymatrix-misc.hpp.
References array, darray, i, and n.
Referenced by operator=().
void dsymatrix::shallow_copy | ( | const _dsymatrix & | mat | ) | [inline] |
make a shallow copy of the matrix
This function is not designed to be used in project codes.
Definition at line 66 of file dsymatrix-misc.hpp.
References array, _dsymatrix::array, darray, _dsymatrix::darray, _dsymatrix::n, n, and _dsymatrix::nullify().
Referenced by operator=().
dsymatrix & dsymatrix::resize | ( | const long & | _n | ) | [inline] |
resize the matrix
Definition at line 79 of file dsymatrix-misc.hpp.
References array, darray, i, and n.
Referenced by read().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes must be positive integers." << std::endl << "Your input was (" << _n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG n =_n; delete [] array; array =new double[n*n]; delete [] darray; darray =new double*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*n]; } return *this; }
_drovector dsymatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 106 of file dsymatrix-misc.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _m>m ){ ERROR_REPORT; std::cerr << "Input row number must be between 0 and " << m << "." << std::endl << "Your input was " << _m << "." << std::endl; exit(1); } #endif//CPPL_DEBUG drovector v(n); for(long j=0; j<n; j++){ v(j)=(*this)(_m,j); } return _(v); }
_dcovector dsymatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 124 of file dsymatrix-misc.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 || _n>n ){ ERROR_REPORT; std::cerr << "Input row number must be between 0 and " << n << "." << std::endl << "Your input was " << _n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector v(m); for(long i=0; i<m; i++){ v(i)=(*this)(i,_n); } return _(v); }
long dsymatrix::dsysv | ( | dgematrix & | mat | ) | [inline] |
solve A*X=Y using dsysv
The argument is dmatrix Y. Y is overwritten and become the solution X. A is also overwritten.
Definition at line 6 of file dsymatrix-lapack.hpp.
References array, dgematrix::array, dgematrix::m, n, and dgematrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrices cannot be solved." << std::endl << "Your input was (" << n << "x" << n << ") and (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG char UPLO('l'); long NRHS(mat.n), LDA(n), *IPIV(new long[n]), LDB(mat.m), LWORK(-1), INFO(1); double *WORK( new double[1] ); dsysv_(UPLO, n, NRHS, array, LDA, IPIV, mat.array, LDB, WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsysv_(UPLO, n, NRHS, array, LDA, IPIV, mat.array, LDB, WORK, LWORK, INFO); delete [] WORK; delete [] IPIV; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsysv | ( | dcovector & | vec | ) | [inline] |
solve A*x=y using dsysv
The argument is dcovector y. y is overwritten and become the solution x. A is also overwritten.
Definition at line 40 of file dsymatrix-lapack.hpp.
References array, dcovector::array, dcovector::l, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << n << "x" << n << ") and (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG char UPLO('l'); long NRHS(1), LDA(n), *IPIV(new long[n]), LDB(vec.l), LWORK(-1), INFO(1); double *WORK( new double[1] ); dsysv_(UPLO, n, NRHS, array, LDA, IPIV, vec.array, LDB, WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsysv_(UPLO, n, NRHS, array, LDA, IPIV, vec.array, LDB, WORK, LWORK, INFO); delete [] WORK; delete [] IPIV; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsyev | ( | std::vector< double > & | w, |
const bool & | jobz = 0 |
||
) | [inline] |
calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w is overwitten and become eigenvalues. This matrix is also overwritten. if jobz=1, this matrix becomes eigenvectors.
Definition at line 82 of file dsymatrix-lapack.hpp.
{VERBOSE_REPORT; w.resize(n); char JOBZ, UPLO('l'); if(jobz==0){ JOBZ='n'; } else{ JOBZ='V'; } long LDA(n), INFO(1), LWORK(-1); double *WORK(new double[1]); dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); delete [] WORK; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsyev | ( | std::vector< double > & | w, |
std::vector< dcovector > & | v | ||
) | [inline] |
calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.
Definition at line 111 of file dsymatrix-lapack.hpp.
{VERBOSE_REPORT; w.resize(n); v.resize(n); for(long i=0; i<n; i++){ v[i].resize(n); } char JOBZ('V'), UPLO('l'); long LDA(n), INFO(1), LWORK(-1); double *WORK(new double[1]); dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); delete [] WORK; //// forming //// for(long i=0; i<n; i++){ for(long j=0; j<n; j++){ v[j](i) = array[i+n*j]; }} if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsyev | ( | std::vector< double > & | w, |
std::vector< drovector > & | v | ||
) | [inline] |
calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.
Definition at line 145 of file dsymatrix-lapack.hpp.
{VERBOSE_REPORT; w.resize(n); v.resize(n); for(long i=0; i<n; i++){ v[i].resize(n); } char JOBZ('V'), UPLO('l'); long LDA(n), INFO(1), LWORK(-1); double *WORK(new double[1]); dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsyev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, INFO); delete [] WORK; //// forming //// for(long i=0; i<n; i++){ for(long j=0; j<n; j++){ v[j](i) = array[i+n*j]; }} if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsygv | ( | dsymatrix & | matB, |
std::vector< double > & | w | ||
) | [inline] |
calculate generalized eigenvalues
w is overwitten and become generalized eigenvalues. This matrix and matB are also overwritten.
Definition at line 181 of file dsymatrix-lapack.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matB.n!=n){ ERROR_REPORT; std::cerr << "The matrix B is not a matrix having the same size as \"this\" matrix." << std::endl << "The B matrix is (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG w.resize(n); char JOBZ('n'), UPLO('l'); long ITYPE(1), LDA(n), LDB(n), LWORK(-1), INFO(1); double *WORK(new double[1]); dsygv_(ITYPE, JOBZ, UPLO, n, array, LDA, matB.array, LDB, &w[0], WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsygv_(ITYPE, JOBZ, UPLO, n, array, LDA, matB.array, LDB, &w[0], WORK, LWORK, INFO); delete [] WORK; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long dsymatrix::dsygv | ( | dsymatrix & | matB, |
std::vector< double > & | w, | ||
std::vector< dcovector > & | v | ||
) | [inline] |
calculate generalized eigenvalues
w is overwitten and become generalized eigenvalues. This matrix and matB are also overwritten.
Definition at line 217 of file dsymatrix-lapack.hpp.
References array, darray, i, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matB.n!=n){ ERROR_REPORT; std::cerr << "The matrix B is not a matrix having the same size as \"this\" matrix." << std::endl << "The B matrix is (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG w.resize(n); v.resize(n); char JOBZ('V'), UPLO('l'); long ITYPE(1), LDA(n), LDB(n), LWORK(-1), INFO(1); double *WORK(new double[1]); dsygv_(ITYPE, JOBZ, UPLO, n, array, LDA, matB.array, LDB, &w[0], WORK, LWORK, INFO); INFO=1; LWORK = long(WORK[0]); std::cout << " LWORK = " << LWORK <<std::endl; delete [] WORK; WORK = new double[LWORK]; dsygv_(ITYPE, JOBZ, UPLO, n, array, LDA, matB.array, LDB, &w[0], WORK, LWORK, INFO); delete [] WORK; //// reforming //// for(int i=0; i<n; i++){ v[i].resize(n); for(int j=0; j<n; j++){ v[i](j) =darray[i][j]; } } if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
dsymatrix & dsymatrix::operator= | ( | const _dsymatrix & | mat | ) | [inline] |
dsymatrix=_dsymatrix operator
Definition at line 3 of file dsymatrix-_dsymatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
dsymatrix+=dsymatrix operator
Definition at line 17 of file dsymatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ darray[j][i] +=mat.darray[j][i]; } } return *this; }
dsymatrix & dsymatrix::operator+= | ( | const _dsymatrix & | mat | ) | [inline] |
dsymatrix+=_dsymatrix operator
Definition at line 15 of file dsymatrix-_dsymatrix.hpp.
References darray, _dsymatrix::darray, _dsymatrix::destroy(), i, n, and _dsymatrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ darray[j][i] +=mat.darray[j][i]; } } mat.destroy(); return *this; }
dsymatrix operator-=
Definition at line 39 of file dsymatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ darray[j][i] -=mat.darray[j][i]; } } return *this; }
dsymatrix & dsymatrix::operator-= | ( | const _dsymatrix & | mat | ) | [inline] |
dsymatrix-=_dsymatrix operator
Definition at line 38 of file dsymatrix-_dsymatrix.hpp.
References darray, _dsymatrix::darray, _dsymatrix::destroy(), i, n, and _dsymatrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ darray[j][i] -=mat.darray[j][i]; } } mat.destroy(); return *this; }
dsymatrix& dsymatrix::operator*= | ( | const _dsymatrix & | ) | [inline] |
dsymatrix & dsymatrix::operator*= | ( | const double & | d | ) | [inline] |
dsymatrix & dsymatrix::operator/= | ( | const double & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const dsymatrix & | mat | ||
) | [friend] |
swap two matrices
Definition at line 146 of file dsymatrix-misc.hpp.
_dsymatrix _ | ( | dsymatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 158 of file dsymatrix-misc.hpp.
Referenced by col(), row(), to_dgematrix(), to_dssmatrix(), and to_zhematrix().
_dsymatrix t | ( | const dsymatrix & | mat | ) | [friend] |
return transposed dgematrix
Definition at line 3 of file dsymatrix-calc.hpp.
_dsymatrix i | ( | const dsymatrix & | mat | ) | [friend] |
return its inverse matrix
Definition at line 16 of file dsymatrix-calc.hpp.
Referenced by chsign(), col(), complete(), copy(), dsyev(), dsygv(), dsymatrix(), identity(), operator()(), operator*=(), operator+=(), operator-=(), operator/=(), read(), resize(), set(), to_dgematrix(), to_dssmatrix(), to_zhematrix(), write(), and zero().
{VERBOSE_REPORT; dsymatrix mat_cp(mat); dsymatrix mat_inv(mat.n); mat_inv.identity(); char UPLO('l'); long NRHS(mat.n), LDA(mat.n), *IPIV(new long[mat.n]), LDB(mat.n), LWORK(-1), INFO(1); double *WORK( new double[1] ); dsysv_(UPLO, mat.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO); LWORK = long(WORK[0]); delete [] WORK; WORK = new double[LWORK]; dsysv_(UPLO, mat.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO); delete [] WORK; delete [] IPIV; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return _(mat_inv); }
search the index of element having the largest absolute value in 0-based numbering system
Definition at line 46 of file dsymatrix-calc.hpp.
return its largest absolute value
Definition at line 62 of file dsymatrix-calc.hpp.
+dsymatrix operator
Definition at line 3 of file dsymatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_dsymatrix operator- | ( | const dsymatrix & | mat | ) | [friend] |
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dsymatrix+dgematrix operator
Definition at line 3 of file dsymatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matB); for(long i=0; i<matA.n; i++) { for(long j=0; j<matA.n; j++) { newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
_dgematrix+dsymatrix operator
Definition at line 3 of file dsymatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.n; i++) { for(long j=0; j<matA.n; j++) { matB(i,j)+=matA(i,j); } } return matB; }
_dsymatrix operator+ | ( | const dsymatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dsymatrix+dsymatrix operator
Definition at line 61 of file dsymatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG long n = matA.n; dsymatrix newmat(n); for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ newmat.darray[j][i] =matA.darray[j][i] +matB.darray[j][i]; } } return _(newmat); }
_dsymatrix operator+ | ( | const dsymatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dsymatrix+_dsymatrix operator
Definition at line 65 of file dsymatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.n; i++){ for(long j=0; j<=i; j++){ matB.darray[j][i] +=matA.darray[j][i]; } } return matB; }
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dsymatrix+dgbmatrix operator
Definition at line 3 of file dsymatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matA.n); for(long i=0; i<matB.m; i++){ for(long j=i; j<matA.n; j++){ newmat(i,j) = newmat(j,i) = matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dsymatrix+_dgbmatrix operator
Definition at line 3 of file dsymatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matA.n); for(long i=0; i<matB.m; i++){ for(long j=i; j<matA.n; j++){ newmat(i,j) = newmat(j,i) = matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } matB.destroy(); return _(newmat); }
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dsymatrix+dgsmatrix operator
Definition at line 3 of file dsymatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) += it->v; } return _(newmat); }
_dgematrix operator+ | ( | const dsymatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dsymatrix+_dgsmatrix operator
Definition at line 3 of file dsymatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) += it->v; } matB.destroy(); return _(newmat); }
_dsymatrix operator+ | ( | const dsymatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dsymatrix operator+ | ( | const dsymatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dsymatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dsymatrix-dgematrix operator
Definition at line 26 of file dsymatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(-matB); for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){ newmat(i,j)+=matA(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dsymatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
_dgematrix-dgematrix operator
Definition at line 25 of file dsymatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){ matB(i,j) =matA(i,j)-matB(i,j); } } return matB; }
_dsymatrix operator- | ( | const dsymatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dsymatrix-dsymatrix operator
Definition at line 85 of file dsymatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG long n = matA.n; dsymatrix newmat(n); for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){ newmat.darray[j][i] =matA.darray[j][i] -matB.darray[j][i]; } } return _(newmat); }
_dsymatrix operator- | ( | const dsymatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dsymatrix-_dsymatrix operator
Definition at line 87 of file dsymatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.n; i++){ for(long j=0; j<=i; j++){ matB.darray[j][i] =matA.darray[j][i] -matB.darray[j][i]; } } return matB; }
_dgematrix operator- | ( | const dsymatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dsymatrix-dgbmatrix operator
Definition at line 29 of file dsymatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matA.n); for(long i=0; i<matB.m; i++){ for(long j=i; j<matA.n; j++){ newmat(i,j) = newmat(j,i) = matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dsymatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dsymatrix-_dgbmatrix operator
Definition at line 30 of file dsymatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matA.n); for(long i=0; i<matB.m; i++){ for(long j=i; j<matA.n; j++){ newmat(i,j) = newmat(j,i) = matA(i,j); } for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } matB.destroy(); return _(newmat); }
_dgematrix operator- | ( | const dsymatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dsymatrix-dgsmatrix operator
Definition at line 24 of file dsymatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) -= it->v; } return _(newmat); }
_dgematrix operator- | ( | const dsymatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dsymatrix-_dgsmatrix operator
Definition at line 25 of file dsymatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) -= it->v; } matB.destroy(); return _(newmat); }
_dsymatrix operator- | ( | const dsymatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dsymatrix operator- | ( | const dsymatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dcovector operator* | ( | const dsymatrix & | mat, |
const dcovector & | vec | ||
) | [friend] |
dsymatrix*dcovector operator
Definition at line 3 of file dsymatrix-dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.n); dsymv_( 'l', mat.n, 1.0, mat.array, mat.n, vec.array, 1, 0.0, newvec.array, 1 ); return _(newvec); }
_dcovector operator* | ( | const dsymatrix & | mat, |
const _dcovector & | vec | ||
) | [friend] |
dsymatrix*_dcovector operator
Definition at line 3 of file dsymatrix-_dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.n); dsymv_( 'l', mat.n, 1.0, mat.array, mat.n, vec.array, 1, 0.0, newvec.array, 1 ); vec.destroy(); return _(newvec); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dsymatrix*dgematrix operator
Definition at line 50 of file dsymatrix-dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.n, matB.n ); dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n, matB.array, matB.m, 0.0, newmat.array, newmat.m ); return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
_dgematrix*dgematrix operator
Definition at line 47 of file dsymatrix-_dgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.n, matB.n ); dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n, matB.array, matB.m, 0.0, newmat.array, newmat.m ); matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dsymatrix*dsymatrix operator
Definition at line 109 of file dsymatrix-dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG matA.complete(); matB.complete(); dgematrix newmat(matA.n, matA.n); dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n, matB.array, matB.n, 0.0, newmat.array, matA.n ); return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dsymatrix*_dsymatrix operator
Definition at line 109 of file dsymatrix-_dsymatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG matA.complete(); matB.complete(); dgematrix newmat( matA.n, matA.n ); dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n, matB.array, matB.n, 0.0, newmat.array, matA.n ); matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dsymatrix*dgbmatrix operator
Definition at line 55 of file dsymatrix-dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.n, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),j-matB.ku); k<std::min(matB.m,j+matB.kl+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dsymatrix*_dgbmatrix operator
Definition at line 57 of file dsymatrix-_dgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( matA.n, matB.n ); newmat.zero(); for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){ for(long k=std::max(long(0),j-matB.ku); k<std::min(matB.m,j+matB.kl+1); k++){ newmat(i,j)+=matA(i,k)*matB(k,j); } } } matB.destroy(); return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dsymatrix*dgsmatrix operator
Definition at line 45 of file dsymatrix-dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matB.n); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ for(long i=0; i<matA.n; i++){ newmat(i,it->j) += matB(i,it->i)*it->v; } } return _(newmat); }
_dgematrix operator* | ( | const dsymatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dsymatrix*_dgsmatrix operator
Definition at line 47 of file dsymatrix-_dgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat(matA.n, matB.n); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ for(long i=0; i<matA.n; i++){ newmat(i,it->j) += matB(i,it->i)*it->v; } } matB.destroy(); return _(newmat); }
_dsymatrix operator* | ( | const dsymatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dsymatrix operator* | ( | const dsymatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dsymatrix operator* | ( | const dsymatrix & | mat, |
const double & | d | ||
) | [friend] |
_dsymatrix operator/ | ( | const dsymatrix & | mat, |
const double & | d | ||
) | [friend] |
_dsymatrix operator* | ( | const double & | d, |
const dsymatrix & | mat | ||
) | [friend] |
long const& dsymatrix::m |
matrix row size
Definition at line 9 of file dsymatrix.hpp.
Referenced by col(), dsymatrix_small< n >::dsymatrix_small(), idamax(), and row().
long dsymatrix::n |
matrix column size
Definition at line 10 of file dsymatrix.hpp.
Referenced by _(), chsign(), clear(), col(), complete(), copy(), dsyev(), dsygv(), dsymatrix(), dsymatrix_small< n >::dsymatrix_small(), dsysv(), i(), idamax(), identity(), operator()(), operator*(), operator*=(), dgematrix::operator*=(), operator+(), operator+=(), dgematrix::operator+=(), operator-(), operator-=(), dgematrix::operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), to_dgematrix(), to_dssmatrix(), to_zhematrix(), write(), and zero().
double* dsymatrix::array |
1D array to store matrix data
Definition at line 11 of file dsymatrix.hpp.
Referenced by _(), chsign(), clear(), copy(), dsyev(), dsygv(), dsymatrix(), dsymatrix_small< n >::dsymatrix_small(), dsysv(), i(), identity(), operator*(), dgematrix::operator*=(), operator-(), operator=(), resize(), shallow_copy(), swap(), zero(), and ~dsymatrix().
double** dsymatrix::darray |
array of pointers of column head addresses
Definition at line 12 of file dsymatrix.hpp.
Referenced by _(), clear(), complete(), copy(), dsygv(), dsymatrix(), idamax(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), resize(), set(), shallow_copy(), swap(), and ~dsymatrix().