CPPLapack
|
Complex Double-precision General Dence Matrix Class. More...
#include <zgematrix.hpp>
Complex Double-precision General Dence Matrix Class.
Definition at line 3 of file zgematrix.hpp.
zgematrix::zgematrix | ( | ) | [inline] |
zgematrix::zgematrix | ( | const zgematrix & | mat | ) | [inline] |
zgematrix copy constructor
Definition at line 18 of file zgematrix-constructor.hpp.
zgematrix::zgematrix | ( | const _zgematrix & | mat | ) | [inline] |
zgematrix constructor to cast _zgematrix
Definition at line 33 of file zgematrix-constructor.hpp.
References array, _zgematrix::array, _zgematrix::darray, darray, m, _zgematrix::m, _zgematrix::n, n, and _zgematrix::nullify().
zgematrix::zgematrix | ( | const long & | _m, |
const long & | _n | ||
) | [inline] |
zgematrix constructor with size specification
Definition at line 49 of file zgematrix-constructor.hpp.
References array, darray, i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes must be positive integers. " << std::endl << "Your input was (" << _m << "," << _n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// initialize //////// m =_m; n =_n; array =new comple[m*n]; darray =new comple*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*m]; } }
zgematrix::zgematrix | ( | const char * | filename | ) | [inline] |
zgematrix::~zgematrix | ( | ) | [inline] |
comple & zgematrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for non-const object
Definition at line 3 of file zgematrix-io.hpp.
References darray, i, m, and n.
Referenced by identity(), operator*=(), operator+=(), operator-=(), read(), and write().
comple zgematrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 20 of file zgematrix-io.hpp.
zgematrix & zgematrix::set | ( | const long & | i, |
const long & | j, | ||
const comple & | v | ||
) | [inline] |
set value for const object
Definition at line 41 of file zgematrix-io.hpp.
References darray, i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || m<=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 //array[i+m*j] =v; darray[j][i] =v; return *this; }
void zgematrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 79 of file zgematrix-io.hpp.
References i, m, 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 << "#zgematrix" << " " << m << " " << n << std::endl; for(long i=0; i<m; i++){ for(long j=0; j<n; j++ ){ ofs << operator()(i,j) << " "; } ofs << std::endl; } ofs.close(); }
void zgematrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 99 of file zgematrix-io.hpp.
References i, m, n, operator()(), and resize().
Referenced by zgematrix().
{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 != "zgematrix" && id != "#zgematrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not zgematrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> m >> n; resize(m, n); 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 zgematrix::clear | ( | ) | [inline] |
zgematrix & zgematrix::zero | ( | ) | [inline] |
change the matrix into a zero matrix
Definition at line 15 of file zgematrix-misc.hpp.
References array, i, m, and n.
Referenced by operator*(), operator*=(), and _zgsmatrix::to_zgematrix().
zgematrix & zgematrix::identity | ( | ) | [inline] |
change the matrix into an identity matrix
Definition at line 25 of file zgematrix-misc.hpp.
References array, i, m, n, and operator()().
Referenced by i().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n){ ERROR_REPORT; std::cerr << "Only square matrix can be a identity matrix." << std::endl << "The matrix size was " << m << "x" << n << "." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m*n; i++){ array[i] =comple(0.0,0.0); } for(long i=0; i<m; i++){ operator()(i,i) =comple(1.0,0.0); } return *this; }
void zgematrix::chsign | ( | ) | [inline] |
void zgematrix::copy | ( | const zgematrix & | mat | ) | [inline] |
make a deep copy of the matrix
Definition at line 51 of file zgematrix-misc.hpp.
References array, darray, i, m, and n.
Referenced by operator=().
void zgematrix::shallow_copy | ( | const _zgematrix & | mat | ) | [inline] |
make a shallow copy of the matrix
This function is not designed to be used in project codes.
Definition at line 67 of file zgematrix-misc.hpp.
References array, _zgematrix::array, _zgematrix::darray, darray, m, _zgematrix::m, _zgematrix::n, n, and _zgematrix::nullify().
Referenced by operator=().
void zgematrix::resize | ( | const long & | _m, |
const long & | _n | ||
) | [inline] |
resize the matrix
Definition at line 81 of file zgematrix-misc.hpp.
References array, darray, i, m, and n.
Referenced by read(), and zgesvd().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes must be positive integers." << std::endl << "Your input was (" << _m << "," << _n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG m =_m; n =_n; delete [] array; array =new comple[m*n]; delete [] darray; darray =new comple*[n]; for(int i=0; i<n; i++){ darray[i] =&array[i*m]; } }
_zrovector zgematrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 107 of file zgematrix-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 zrovector v(n); for(long j=0; j<n; j++){ v(j)=(*this)(_m,j); } return _(v); }
_zcovector zgematrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 125 of file zgematrix-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 zcovector v(m); for(long i=0; i<m; i++){ v(i)=(*this)(i,_n); } return _(v); }
long zgematrix::zgesv | ( | zgematrix & | mat | ) | [inline] |
solve A*X=Y using zgesv
The argument is zgematrix Y. Y is overwritten and become the solution X. A is also overwritten and become P*l*U.
Definition at line 5 of file zgematrix-lapack.hpp.
Referenced by i().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrices cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG long NRHS(mat.n), LDA(n), *IPIV(new long[n]), LDB(mat.m), INFO(1); zgesv_(n, NRHS, array, LDA, IPIV, mat.array, LDB, INFO); delete [] IPIV; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgesv | ( | zcovector & | vec | ) | [inline] |
solve A*x=y using zgesv
The argument is zcovector y. y is overwritten and become the solution x. A is also overwritten and become P*l*U.
Definition at line 31 of file zgematrix-lapack.hpp.
References zcovector::array, array, zcovector::l, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n || m!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG long NRHS(1), LDA(n), *IPIV(new long[n]), LDB(vec.l), INFO(1); zgesv_(n, NRHS, array, LDA, IPIV, vec.array, LDB, INFO); delete [] IPIV; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgels | ( | zgematrix & | mat | ) | [inline] |
solve overdetermined or underdetermined A*X=Y using zgels
Definition at line 58 of file zgematrix-lapack.hpp.
References array, clear(), i, m, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrices cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if(m<n){ //underdetermined zgematrix tmp(n,mat.n); for(long i=0; i<mat.m; i++){ for(long j=0; j<mat.n; j++){ tmp(i,j) =mat(i,j); }} mat.clear(); swap(mat,tmp); } char TRANS('n'); long NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); comple *WORK(new comple[LWORK]); zgels_(TRANS, m, n, NRHS, array, LDA, mat.array, LDB, WORK, LWORK, INFO); delete [] WORK; if(m>n){ //overdetermined zgematrix tmp(n,mat.n); for(long i=0; i<tmp.m; i++){ for(long j=0; j<tmp.n; j++){ tmp(i,j) =mat(i,j); }} mat.clear(); swap(mat,tmp); } if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgels | ( | zcovector & | vec | ) | [inline] |
solve overdetermined or underdetermined A*x=y using zgels
Definition at line 103 of file zgematrix-lapack.hpp.
References zcovector::array, array, zcovector::clear(), i, zcovector::l, m, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if(m<n){ //underdetermined zcovector tmp(n); for(long i=0; i<vec.l; i++){ tmp(i)=vec(i); } vec.clear(); swap(vec,tmp); } char TRANS('n'); long NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); comple *WORK(new comple[LWORK]); zgels_(TRANS, m, n, NRHS, array, LDA, vec.array, LDB, WORK, LWORK, INFO); delete [] WORK; if(m>n){ //overdetermined zcovector tmp(n); for(long i=0; i<tmp.l; i++){ tmp(i)=vec(i); } vec.clear(); swap(vec,tmp); } if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgels | ( | zgematrix & | mat, |
drovector & | residual | ||
) | [inline] |
solve overdetermined or underdetermined A*X=Y using zgels with the sum of residual squares output
The residual is set as the columnwise sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.
Definition at line 149 of file zgematrix-lapack.hpp.
References array, clear(), i, drovector::l, m, n, drovector::resize(), swap, and drovector::zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrices cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG residual.resize(mat.n); residual.zero(); if(m<n){ //underdetermined zgematrix tmp(n,mat.n); for(long i=0; i<mat.m; i++){ for(long j=0; j<mat.n; j++){ tmp(i,j) =mat(i,j); }} mat.clear(); swap(mat,tmp); } char TRANS('n'); long NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); comple *WORK(new comple[LWORK]); zgels_(TRANS, m, n, NRHS, array, LDA, mat.array, LDB, WORK, LWORK, INFO); delete [] WORK; if(m>n){ //overdetermined for(long i=0; i<residual.l; i++){ for(long j=0; j<m-n; j++){ residual(i) += std::norm(mat(n+j,i)); }} zgematrix tmp(n,mat.n); for(long i=0; i<tmp.m; i++){ for(long j=0; j<tmp.n; j++){ tmp(i,j) =mat(i,j); }} mat.clear(); swap(mat,tmp); } if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgels | ( | zcovector & | vec, |
double & | residual | ||
) | [inline] |
solve overdetermined or underdetermined A*x=y using zgels with the sum of residual squares output
The residual is set as the sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.
Definition at line 204 of file zgematrix-lapack.hpp.
References zcovector::array, array, zcovector::clear(), i, zcovector::l, m, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG residual=0.0; if(m<n){ //underdetermined zcovector tmp(n); for(long i=0; i<vec.l; i++){ tmp(i)=vec(i); } vec.clear(); swap(vec,tmp); } char TRANS('n'); long NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); comple *WORK(new comple[LWORK]); zgels_(TRANS, m, n, NRHS, array, LDA, vec.array, LDB, WORK, LWORK, INFO); delete [] WORK; if(m>n){ //overdetermined for(long i=0; i<m-n; i++){ residual+=std::norm(vec(n+i)); } zcovector tmp(n); for(long i=0; i<tmp.l; i++){ tmp(i)=vec(i); } vec.clear(); swap(vec,tmp); } if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgelss | ( | zcovector & | B, |
dcovector & | S, | ||
long & | RANK, | ||
const double | RCOND = -1. |
||
) | [inline] |
calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using zgelss
Definition at line 254 of file zgematrix-lapack.hpp.
References zcovector::array, array, dcovector::array, zcovector::clear(), i, zcovector::l, m, n, dcovector::resize(), and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=B.l){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << B.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if(m<n){ //underdetermined zcovector tmp(n); for(long i=0; i<B.l; i++){ tmp(i)=B(i); } B.clear(); swap(B,tmp); } S.resize(std::min(m,n)); long NRHS(1), LDA(m), LDB(B.l), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1); double *RWORK(new double[5*std::min(m,n)]); comple *WORK(new comple[LWORK]); zgelss_(m, n, NRHS, array, LDA, B.array, LDB, S.array, RCOND, RANK, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgelss | ( | zgematrix & | B, |
dcovector & | S, | ||
long & | RANK, | ||
const double | RCOND = -1. |
||
) | [inline] |
calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using zgelss
Definition at line 293 of file zgematrix-lapack.hpp.
References array, dcovector::array, clear(), i, m, n, dcovector::resize(), and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=B.m){ ERROR_REPORT; std::cerr << "These matrix and vector cannot be solved." << std::endl << "Your input was (" << m << "x" << n << ") and (" << B.m << "x" << B.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if(m<n){ //underdetermined zgematrix tmp(n,B.n); for(long i=0; i<B.m; i++){ for(long j=0; j<B.n; j++){ tmp(i,j)=B(i,j); } } B.clear(); swap(B,tmp); } S.resize(std::min(m,n)); long NRHS(B.n), LDA(m), LDB(B.m), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1); double *RWORK(new double[5*std::min(m,n)]); comple *WORK(new comple[LWORK]); zgelss_(m, n, NRHS, array, LDA, B.array, LDB, S.array, RCOND, RANK, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgeev | ( | std::vector< comple > & | w | ) | [inline] |
calculate eigenvalues
The argument need not to be initialized. w is overwitten and become eigenvalues. This matrix is also overwritten.
Definition at line 342 of file zgematrix-lapack.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n){ ERROR_REPORT; std::cerr << "This matrix cannot have eigenvalues." << std::endl << "Your input was (" << m << "x" << n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG w.resize(n); char JOBVL('n'), JOBVR('n'); long LDA(n), LDVL(1), LDVR(1), LWORK(4*n), INFO(1); double *RWORK(new double[2*n]); comple *VL(NULL), *VR(NULL), *WORK(new comple[LWORK]); zgeev_(JOBVL, JOBVR, n, array, LDA, &w[0], VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; delete [] VL; delete [] VR; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgeev | ( | std::vector< comple > & | w, |
std::vector< zcovector > & | vr | ||
) | [inline] |
calculate eigenvalues and right eigenvectors
All of the arguments need not to be initialized. w, vr are overwitten and become eigenvalues and right eigenvectors, respectively. This matrix is also overwritten.
Definition at line 376 of file zgematrix-lapack.hpp.
References array, i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n){ ERROR_REPORT; std::cerr << "This matrix cannot have eigenvalues." << std::endl << "Your input was (" << m << "x" << n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG w.resize(n); vr.resize(n); for(long i=0; i<n; i++){ vr[i].resize(n); } zgematrix VR(n,n); char JOBVL('n'), JOBVR('V'); long LDA(n), LDVL(1), LDVR(n), LWORK(4*n), INFO(1); double *RWORK(new double[2*n]); comple *VL(NULL), *WORK(new comple[LWORK]); zgeev_(JOBVL, JOBVR, n, array, LDA, &w[0], VL, LDVL, VR.array, LDVR, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; delete [] VL; //// forming //// for(long j=0; j<n; j++){ for(long i=0; i<n; i++){ vr[j](i) = VR(i,j); }} if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgeev | ( | std::vector< comple > & | w, |
std::vector< zrovector > & | vl | ||
) | [inline] |
calculate eigenvalues and left eigenvectors
All of the arguments need not to be initialized. w, vr are overwitten and become eigenvalues and left eigenvectors, respectively. This matrix is also overwritten.
Definition at line 417 of file zgematrix-lapack.hpp.
References array, conj(), i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(m!=n){ ERROR_REPORT; std::cerr << "This matrix cannot have eigenvalues." << std::endl << "Your input was (" << m << "x" << n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG w.resize(n); vl.resize(n); for(long i=0; i<n; i++){ vl[i].resize(n); } zgematrix VL(n,n); char JOBVL('V'), JOBVR('n'); long LDA(n), LDVL(n), LDVR(1), LWORK(4*n), INFO(1); double *RWORK(new double[2*n]); comple *VR(NULL), *WORK(new comple[LWORK]); zgeev_(JOBVL, JOBVR, n, array, LDA, &w[0], VL.array, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; delete [] VR; //// forming //// for(long j=0; j<n; j++){ for(long i=0; i<n; i++){ vl[j](i) = std::conj(VL(i,j)); }} if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
long zgematrix::zgesvd | ( | dcovector & | S, |
zgematrix & | U, | ||
zgematrix & | VT | ||
) | [inline] |
compute the singular value decomposition (SVD)
The arguments are zcocector S, zgematrix U and VT. All of them need not to be initialized. S, U and VT are overwitten and become singular values, left singular vectors, and right singular vectors respectively. This matrix also overwritten.
Definition at line 473 of file zgematrix-lapack.hpp.
References array, dcovector::array, m, n, resize(), and dcovector::resize().
{VERBOSE_REPORT; char JOBU('A'), JOBVT('A'); long LDA(m), LDU(m), LDVT(n), LWORK(std::max(3*std::min(m,n)+std::max(m,n),5*std::min(m,n))), INFO(1); double *RWORK(new double[5*std::min(m,n)]); comple *WORK(new comple[LWORK]); S.resize(std::min(m,n)); U.resize(LDU,m); VT.resize(LDVT,n); zgesvd_(JOBU, JOBVT, m, n, array, LDA, S.array, U.array, LDU, VT.array, LDVT, WORK, LWORK, RWORK, INFO); delete [] RWORK; delete [] WORK; if(INFO!=0){ WARNING_REPORT; std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; } return INFO; }
zgematrix & zgematrix::operator= | ( | const _zgematrix & | mat | ) | [inline] |
zgematrix=_zgematrix operator
Definition at line 3 of file zgematrix-_zgematrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
zgematrix+=zgematrix operator
Definition at line 17 of file zgematrix-zgematrix.hpp.
References array, i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m*n; i++){ array[i]+=mat.array[i]; } return *this; }
zgematrix & zgematrix::operator+= | ( | const _zgematrix & | mat | ) | [inline] |
zgematrix+=_zgematrix operator
Definition at line 15 of file zgematrix-_zgematrix.hpp.
References array, _zgematrix::array, _zgematrix::destroy(), i, _zgematrix::m, m, n, and _zgematrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m*n; i++){ array[i]+=mat.array[i]; } mat.destroy(); return *this; }
zgematrix+=zhematrix operator
Definition at line 3 of file zgematrix-zhematrix.hpp.
References i, m, n, zhematrix::n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m; i++){ for( long j=0; j<n; j++){ operator()(i,j) += mat(i,j); }} return *this; }
zgematrix & zgematrix::operator+= | ( | const _zhematrix & | mat | ) | [inline] |
zgematrix+=_zhematrix operator
Definition at line 3 of file zgematrix-_zhematrix.hpp.
References _zhematrix::destroy(), i, m, _zhematrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m; i++){ for(long j=0; j<n; j++){ operator()(i,j) +=mat(i,j); }} mat.destroy(); return *this; }
zgematrix+=zgbmatrix operator
Definition at line 3 of file zgematrix-zgbmatrix.hpp.
References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, zgbmatrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<mat.m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)+=mat(i,j); } } return *this; }
zgematrix & zgematrix::operator+= | ( | const _zgbmatrix & | mat | ) | [inline] |
zgematrix+=_zgbmatrix operator
Definition at line 3 of file zgematrix-_zgbmatrix.hpp.
References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<mat.m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)+=mat(i,j); } } mat.destroy(); return *this; }
zgematrix& zgematrix::operator+= | ( | const _zgsmatrix & | ) | [inline] |
zgematrix& zgematrix::operator+= | ( | const _zhsmatrix & | ) | [inline] |
zgematrix operator-=
Definition at line 34 of file zgematrix-zgematrix.hpp.
References array, i, m, and n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m*n; i++){ array[i]-=mat.array[i]; } return *this; }
zgematrix & zgematrix::operator-= | ( | const _zgematrix & | mat | ) | [inline] |
zgematrix-=_zgematrix operator
Definition at line 34 of file zgematrix-_zgematrix.hpp.
References array, _zgematrix::array, _zgematrix::destroy(), i, _zgematrix::m, m, n, and _zgematrix::n.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m*n; i++){ array[i]-=mat.array[i]; } mat.destroy(); return *this; }
zgematrix-=zhematrix operator
Definition at line 23 of file zgematrix-zhematrix.hpp.
References i, m, n, zhematrix::n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m; i++){ for(long j=0; j<n; j++){ operator()(i,j) -= mat(i,j); }} return *this; }
zgematrix & zgematrix::operator-= | ( | const _zhematrix & | mat | ) | [inline] |
zgematrix-=_zhematrix operator
Definition at line 24 of file zgematrix-_zhematrix.hpp.
References _zhematrix::destroy(), i, m, _zhematrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a sutraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<m; i++){ for(long j=0; j<n; j++){ operator()(i,j) -=mat(i,j); }} mat.destroy(); return *this; }
zgematrix-=zgbmatrix operator
Definition at line 25 of file zgematrix-zgbmatrix.hpp.
References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, zgbmatrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<mat.m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)-=mat(i,j); } } return *this; }
zgematrix & zgematrix::operator-= | ( | const _zgbmatrix & | mat | ) | [inline] |
zgematrix-=_zgbmatrix operator
Definition at line 26 of file zgematrix-_zgbmatrix.hpp.
References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, _zgbmatrix::n, n, and operator()().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n || m!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<mat.m; i++){ for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){ operator()(i,j)-=mat(i,j); } } mat.destroy(); return *this; }
zgematrix& zgematrix::operator-= | ( | const _zgsmatrix & | ) | [inline] |
zgematrix& zgematrix::operator-= | ( | const _zhsmatrix & | ) | [inline] |
zgematrix operator*=
Definition at line 51 of file zgematrix-zgematrix.hpp.
References array, m, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( m, mat.n ); zgemm_( 'n', 'n', m, mat.n, n, comple(1.0,0.0), array, m, mat.array, mat.m, comple(0.0,0.0), newmat.array, m ); swap(*this,newmat); return *this; }
zgematrix & zgematrix::operator*= | ( | const _zgematrix & | mat | ) | [inline] |
zgematrix*=_zgematrix operator
Definition at line 53 of file zgematrix-_zgematrix.hpp.
References array, _zgematrix::array, _zgematrix::destroy(), _zgematrix::m, m, _zgematrix::n, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( m, mat.n ); zgemm_( 'n', 'n', m, mat.n, n, comple(1.0,0.0), array, m, mat.array, mat.m, comple(0.0,0.0), newmat.array, m ); swap(*this,newmat); mat.destroy(); return *this; }
zgematrix*=zhematrix operator
Definition at line 43 of file zgematrix-zhematrix.hpp.
References array, zhematrix::array, m, n, zhematrix::n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( m, mat.n ); zhemm_( 'R', 'l', mat.n, n, comple(1.0,0.0), mat.array, mat.n, array, m, comple(0.0,0.0), newmat.array, newmat.m ); swap(*this,newmat); return *this; }
zgematrix & zgematrix::operator*= | ( | const _zhematrix & | mat | ) | [inline] |
zgematrix*=_zhematrix operator
Definition at line 45 of file zgematrix-_zhematrix.hpp.
References _zhematrix::array, array, _zhematrix::destroy(), m, _zhematrix::n, n, and swap.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( m, mat.n ); zhemm_( 'R', 'l', mat.n, n, comple(1.0,0.0), mat.array, mat.n, array, m, comple(0.0,0.0), newmat.array, newmat.m ); swap(*this,newmat); mat.destroy(); return *this; }
zgematrix*=zgbmatrix operator
Definition at line 46 of file zgematrix-zgbmatrix.hpp.
References i, zgbmatrix::kl, zgbmatrix::ku, m, zgbmatrix::m, n, zgbmatrix::n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(m,mat.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-mat.ku); k<std::min(mat.m,j+mat.kl+1); k++){ newmat(i,j)+=operator()(i,k)*mat(k,j); } } } swap(*this,newmat); return *this; }
zgematrix & zgematrix::operator*= | ( | const _zgbmatrix & | mat | ) | [inline] |
zgematrix*=_zgbmatrix operator
Definition at line 48 of file zgematrix-_zgbmatrix.hpp.
References _zgbmatrix::destroy(), i, _zgbmatrix::kl, _zgbmatrix::ku, m, _zgbmatrix::m, n, _zgbmatrix::n, operator()(), swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(m,mat.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-mat.ku); k<std::min(mat.m,j+mat.kl+1); k++){ newmat(i,j)+=operator()(i,k)*mat(k,j); } } } swap(*this,newmat); mat.destroy(); return *this; }
zgematrix& zgematrix::operator*= | ( | const _zgsmatrix & | ) | [inline] |
zgematrix& zgematrix::operator*= | ( | const _zhsmatrix & | ) | [inline] |
zgematrix & zgematrix::operator*= | ( | const double & | d | ) | [inline] |
zgematrix & zgematrix::operator*= | ( | const comple & | d | ) | [inline] |
zgematrix & zgematrix::operator/= | ( | const double & | d | ) | [inline] |
zgematrix & zgematrix::operator/= | ( | const comple & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const zgematrix & | mat | ||
) | [friend] |
swap two matrices
Definition at line 147 of file zgematrix-misc.hpp.
Referenced by operator*=(), zgels(), and zgelss().
_zgematrix _ | ( | zgematrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 159 of file zgematrix-misc.hpp.
_zgematrix t | ( | const zgematrix & | mat | ) | [friend] |
_zgematrix i | ( | const zgematrix & | mat | ) | [friend] |
return its inverse matrix
Definition at line 16 of file zgematrix-calc.hpp.
Referenced by chsign(), col(), copy(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), write(), zero(), zgeev(), zgels(), zgelss(), and zgematrix().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.m!=mat.n){ ERROR_REPORT; std::cerr << "This matrix is not square and has no inverse matrix." << std::endl << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix mat_cp(mat), mat_inv(mat.m,mat.n); mat_inv.identity(); mat_cp.zgesv(mat_inv); return _(mat_inv); }
_zgematrix conj | ( | const zgematrix & | mat | ) | [friend] |
_zgematrix conjt | ( | const zgematrix & | mat | ) | [friend] |
+zgematrix operator
Definition at line 3 of file zgematrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_zgematrix operator- | ( | const zgematrix & | mat | ) | [friend] |
_zgematrix operator+ | ( | const zgematrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgematrix+zgematrix operator
Definition at line 76 of file zgematrix-zgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m,matA.n); for(long i=0; i<newmat.m*newmat.n; i++){ newmat.array[i] =matA.array[i]+matB.array[i]; } return _(newmat); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgematrix+_zgematrix operator
Definition at line 79 of file zgematrix-_zgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.m*matA.n; i++){ matB.array[i] +=matA.array[i]; } return matB; }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgematrix+zhematrix operator
Definition at line 69 of file zgematrix-zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){ newmat(i,j) += matB(i,j); }} return _(newmat); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgematrix+_zhematrix operator
Definition at line 72 of file zgematrix-_zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){ newmat(i,j) +=matB(i,j); }} matB.destroy(); return _(newmat); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgematrix+zgbmatrix operator
Definition at line 77 of file zgematrix-zgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matB.m; i++){ 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); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgematrix+_zgbmatrix operator
Definition at line 81 of file zgematrix-_zgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matB.m; i++){ 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); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgematrix+zgsmatrix operator
Definition at line 3 of file zgematrix-zgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; newmat(z.i,z.j) += z.v; } return _(newmat); }
_zgematrix operator+ | ( | const zgematrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgematrix+_zgsmatrix operator
Definition at line 3 of file zgematrix-_zgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; newmat(z.i,z.j) += z.v; } matB.destroy(); return _(newmat); }
_zgematrix operator+ | ( | const zgematrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zgematrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zgematrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgematrix-zgematrix operator
Definition at line 97 of file zgematrix-zgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m,matA.n); for(long i=0; i<newmat.m*newmat.n; i++){ newmat.array[i] =matA.array[i]-matB.array[i]; } return _(newmat); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgematrix-_zgematrix operator
Definition at line 97 of file zgematrix-_zgematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG for(long i=0; i<matA.m*matA.n; i++){ matB.array[i] =matA.array[i]-matB.array[i]; } return matB; }
_zgematrix operator- | ( | const zgematrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgematrix-zhematrix operator
Definition at line 90 of file zgematrix-zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){ newmat(i,j) -= matB(i,j); }} return _(newmat); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgematrix-_zhematrix operator
Definition at line 94 of file zgematrix-_zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){ newmat(i,j) -=matB(i,j); }} matB.destroy(); return _(newmat); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgematrix-zgbmatrix operator
Definition at line 101 of file zgematrix-zgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matB.m; i++){ 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); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgematrix-_zgbmatrix operator
Definition at line 106 of file zgematrix-_zgbmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.n!=matB.n || matA.m!=matB.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a summation." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(long i=0; i<matB.m; i++){ 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); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgematrix-zgsmatrix operator
Definition at line 25 of file zgematrix-zgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; newmat(z.i,z.j) -= z.v; } return _(newmat); }
_zgematrix operator- | ( | const zgematrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgematrix-_zgsmatrix operator
Definition at line 26 of file zgematrix-_zgsmatrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.m || matA.n!=matB.n){ ERROR_REPORT; std::cerr << "These two matrises can not make a subtraction." << std::endl << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; newmat(z.i,z.j) -= z.v; } matB.destroy(); return _(newmat); }
_zgematrix operator- | ( | const zgematrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zgematrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zcovector operator* | ( | const zgematrix & | mat, |
const zcovector & | vec | ||
) | [friend] |
zgematrix*zcovector operator
Definition at line 3 of file zgematrix-zcovector.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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zcovector newvec(mat.m); zgemv_( 'n', mat.m, mat.n, comple(1.0,0.0), mat.array, mat.m, vec.array, 1, comple(0.0,0.0), newvec.array, 1 ); return _(newvec); }
_zcovector operator* | ( | const zgematrix & | mat, |
const _zcovector & | vec | ||
) | [friend] |
zgematrix*_zcovector operator
Definition at line 3 of file zgematrix-_zcovector.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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zcovector newvec(mat.m); zgemv_( 'n', mat.m, mat.n, comple(1.0,0.0), mat.array, mat.m, vec.array, 1, comple(0.0,0.0), newvec.array, 1 ); vec.destroy(); return _(newvec); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgematrix*zgematrix operator
Definition at line 118 of file zgematrix-zgematrix.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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.m, matB.n ); zgemm_( 'n', 'n', matA.m, matB.n, matA.n, comple(1.0,0.0), matA.array, matA.m, matB.array, matB.m, comple(0.0,0.0), newmat.array, matA.m ); return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgematrix*_zgematrix operator
Definition at line 117 of file zgematrix-_zgematrix.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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.m, matB.n ); zgemm_( 'n', 'n', matA.m, matB.n, matA.n, comple(1.0,0.0), matA.array, matA.m, matB.array, matB.m, comple(0.0,0.0), newmat.array, matA.m ); matB.destroy(); return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgematrix*zhematrix operator
Definition at line 111 of file zgematrix-zhematrix.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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.m, matA.n ); zhemm_( 'R', 'l', newmat.m, newmat.n, comple(1.0,0.0), matB.array, newmat.n, matA.array, newmat.m, comple(0.0,0.0), newmat.array, newmat.m ); return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgematrix*_zhematrix operator
Definition at line 116 of file zgematrix-_zhematrix.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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.n, matB.n ); zhemm_( 'R', 'l', matB.n, matA.n, comple(1.0,0.0), matB.array, matB.n, matA.array, matA.m, comple(0.0,0.0), newmat.array, newmat.m ); matB.destroy(); return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgematrix*zgbmatrix operator
Definition at line 125 of file zgematrix-zgbmatrix.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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.m, 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); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgematrix*_zgbmatrix operator
Definition at line 131 of file zgematrix-_zgbmatrix.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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matA.m, 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); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgematrix*zgsmatrix operator
Definition at line 47 of file zgematrix-zgsmatrix.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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m, matB.n); newmat.zero(); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; for(long i=0; i<matA.m; i++){ newmat(i,z.j) += matA(i,z.i)*z.v; } } return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgematrix*_zgsmatrix operator
Definition at line 49 of file zgematrix-_zgsmatrix.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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m, matB.n); newmat.zero(); for(size_t c=0; c<matB.data.size(); c++){ const zcomponent& z =matB.data[c]; for(long i=0; i<matA.m; i++){ newmat(i,z.j) += matA(i,z.i)*z.v; } } matB.destroy(); return _(newmat); }
_zgematrix operator* | ( | const zgematrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zgematrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zgematrix & | mat, |
const double & | d | ||
) | [friend] |
_zgematrix operator* | ( | const zgematrix & | mat, |
const comple & | d | ||
) | [friend] |
_zgematrix operator/ | ( | const zgematrix & | mat, |
const double & | d | ||
) | [friend] |
_zgematrix operator/ | ( | const zgematrix & | mat, |
const comple & | d | ||
) | [friend] |
_zgematrix operator* | ( | const double & | d, |
const zgematrix & | mat | ||
) | [friend] |
_zgematrix operator* | ( | const comple & | d, |
const zgematrix & | mat | ||
) | [friend] |
long zgematrix::m |
matrix row size
Definition at line 9 of file zgematrix.hpp.
Referenced by _(), chsign(), clear(), col(), conj(), conjt(), copy(), damax(), i(), idamax(), identity(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), t(), write(), zero(), zgbmatrix::zgbsv(), zgeev(), zgels(), zgelss(), zgematrix(), zgematrix_small< m, n >::zgematrix_small(), zgesv(), and zgesvd().
long zgematrix::n |
matrix column size
Definition at line 10 of file zgematrix.hpp.
Referenced by _(), chsign(), clear(), col(), conj(), conjt(), copy(), damax(), i(), idamax(), identity(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), row(), set(), shallow_copy(), swap(), t(), write(), zero(), zgbmatrix::zgbsv(), zgeev(), zgels(), zgelss(), zgematrix(), zgematrix_small< m, n >::zgematrix_small(), zgesv(), zgesvd(), and zhematrix::zhesv().
comple* zgematrix::array |
1D array to store matrix data
Definition at line 11 of file zgematrix.hpp.
Referenced by _(), chsign(), clear(), copy(), damax(), idamax(), identity(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), resize(), shallow_copy(), swap(), _dgematrix::to_zgematrix(), dgematrix::to_zgematrix(), zero(), zgbmatrix::zgbsv(), zgeev(), zgels(), zgelss(), zgematrix(), zgematrix_small< m, n >::zgematrix_small(), zgesv(), zgesvd(), zhematrix::zhesv(), and ~zgematrix().
comple** zgematrix::darray |
array of pointers of column head addresses
Definition at line 12 of file zgematrix.hpp.
Referenced by _(), clear(), copy(), operator()(), resize(), set(), shallow_copy(), swap(), zgematrix(), and ~zgematrix().