CPPLapack
|
Complex Double-precision Hermitian Sparse Matrix Class. More...
#include <zhsmatrix.hpp>
Complex Double-precision Hermitian Sparse Matrix Class.
Definition at line 3 of file zhsmatrix.hpp.
zhsmatrix::zhsmatrix | ( | ) | [inline] |
zhsmatrix::zhsmatrix | ( | const zhsmatrix & | mat | ) | [inline] |
zhsmatrix::zhsmatrix | ( | const _zhsmatrix & | mat | ) | [inline] |
zhsmatrix constructor to cast _zhsmatrix
Definition at line 28 of file zhsmatrix-constructor.hpp.
References data, _zhsmatrix::data, line, _zhsmatrix::line, _zhsmatrix::n, n, and _zhsmatrix::nullify().
zhsmatrix::zhsmatrix | ( | const long & | _n, |
const long | _c = 0 |
||
) | [inline] |
zhsmatrix constructor with size specification
Definition at line 47 of file zhsmatrix-constructor.hpp.
: m(n) {VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 || _c<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl << "Your input was (" << _n << "," << _c << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// initialize //////// n =_n; data.resize(0); data.reserve(_c); line.resize(n); }
zhsmatrix::zhsmatrix | ( | const char * | filename | ) | [inline] |
zhsmatrix::zhsmatrix | ( | const zgematrix & | ) | [inline] |
zhsmatrix::~zhsmatrix | ( | ) | [inline] |
_zgematrix zhsmatrix::to_zgematrix | ( | ) | const [inline] |
convert to _zgematrix
Definition at line 3 of file zhsmatrix-cast.hpp.
_zhematrix zhsmatrix::to_zhematrix | ( | ) | const [inline] |
convert to _zhematrix
Definition at line 17 of file zhsmatrix-cast.hpp.
References _, data, n, and zhematrix::zero().
_zgsmatrix zhsmatrix::to_zgsmatrix | ( | ) | const [inline] |
convert to _zgsmatrix
Definition at line 31 of file zhsmatrix-cast.hpp.
References _, conj(), data, m, n, zgsmatrix::put(), and zgsmatrix::zero().
Referenced by operator*(), and operator/().
comple zhsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 3 of file zhsmatrix-io.hpp.
References conj(), data, line, and n.
{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 //// search (i,j) component //// const uint32_t ii(std::max(i,j)), jj(std::min(i,j)); for(std::vector<uint32_t>::const_iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if(data[*p].j==jj){ if( i>j ){ return data[*p].v; }//ii=i else{ return std::conj(data[*p].v); }//ii=j } } //// (i,j) component was not found //// return comple(0.0,0.0); }
zhecomplex zhsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator()
Definition at line 29 of file zhsmatrix-io.hpp.
References data, i(), line, and n.
{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 //////// search (i,j) component //////// const uint32_t ii(std::max(i,j)), jj(std::min(i,j)); for(std::vector<uint32_t>::const_iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if(data[*p].j==jj){ return zhecomplex(i,j, data[*p].v); } } //////// (i,j) component not found //////// line[i].push_back(data.size()); if(i!=j){//off-diagonal line[j].push_back(data.size()); } data.push_back(zcomponent(ii,jj,comple(0.,0.))); return zhecomplex(i,j, data.back().v); }
zhsmatrix & zhsmatrix::put | ( | const long & | i, |
const long & | j, | ||
const comple & | v | ||
) | [inline] |
put value with volume cheack without isListed check
Definition at line 63 of file zhsmatrix-io.hpp.
References data, isListed(), line, and n.
Referenced by read(), _dssmatrix::to_zhsmatrix(), and dssmatrix::to_zhsmatrix().
{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); } if( isListed(i,j) ){ ERROR_REPORT; std::cerr << "The required component is already listed." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //// push //// const long ii(std::max(i,j)), jj(std::min(i,j)); line[ii].push_back(data.size()); if(i!=j){//off-diagonal line[jj].push_back(data.size()); } data.push_back(zcomponent(ii,jj,v)); return *this; }
zhsmatrix & zhsmatrix::del | ( | const long | i, |
const long | j | ||
) | [inline] |
delete the entry of a component
Definition at line 97 of file zhsmatrix-io.hpp.
Referenced by diet(), and stretch().
{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 const long ii(std::max(i,j)), jj(std::min(i,j)); //////// search (i,j) component //////// for(std::vector<uint32_t>::iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if( long(data[*p].i)==ii && long(data[*p].j)==jj ){//exists //// save position //// uint32_t c(*p); uint32_t C(data.size()-1); //// data translation //// data[c]=data.back(); data.pop_back(); //// remove from List //// line[ii].erase(p); if(i!=j){//off-diagonal for(std::vector<uint32_t>::iterator pj=line[jj].begin(); pj!=line[jj].end(); pj++){ if(*pj==c){ line[jj].erase(pj); break; } } } //// modify the entry of translated component //// uint32_t I(data[c].i), J(data[c].j); for(std::vector<uint32_t>::iterator q=line[I].begin(); q!=line[I].end(); q++){ if(*q==C){ *q=c; break; } } if(I!=J){//off-diagonal for(std::vector<uint32_t>::iterator q=line[J].begin(); q!=line[J].end(); q++){ if(*q==C){ *q=c; break; } } } return *this; } } #ifdef CPPL_DEBUG std::cerr << "# [NOTE]@zhsmatrix::del(long&, long&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; #endif//CPPL_DEBUG return *this; }
zhsmatrix & zhsmatrix::del | ( | const long | c | ) | [inline] |
delete the entry of an element
Definition at line 152 of file zhsmatrix-io.hpp.
References data, i(), and line.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( c<0 || c>=long(data.size()) ){ ERROR_REPORT; std::cerr << "The required element is out of the matrix volume." << std::endl << "Your input was (" << c << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG if( c==long(data.size()-1) ){//if c is the last element long i(data[c].i), j(data[c].j); for(std::vector<uint32_t>::iterator q=line[i].begin(); q!=line[i].end(); q++){ if( long(*q)==c ){ line[i].erase(q); break; } } if(i!=j){//off-diagonal for(std::vector<uint32_t>::iterator q=line[j].begin(); q!=line[j].end(); q++){ if( long(*q)==c ){ line[j].erase(q); break; } } } data.pop_back(); } else{//c is NOT the last element //// data translation //// uint32_t C(data.size()-1); long i(data[c].i), j(data[c].j), I(data.back().i), J(data.back().j); data[c]=data.back(); //std::cerr << "c=" << c << " i=" << i << " j=" << j << " C=" << vol << " I=" << I << " J=" << J << std::endl; //// remove entry of component //// for(std::vector<uint32_t>::iterator q=line[i].begin(); q!=line[i].end(); q++){ if( long(*q)==c ){ line[i].erase(q); break; } } if(i!=j){//off-diagonal for(std::vector<uint32_t>::iterator q=line[j].begin(); q!=line[j].end(); q++){ if( long(*q)==c ){ line[j].erase(q); break; } } } //// modify the entry of translated component //// for(std::vector<uint32_t>::iterator q=line[I].begin(); q!=line[I].end(); q++){ if(*q==C){ *q=c; break; } } if(I!=J){//off-diagonal for(std::vector<uint32_t>::iterator q=line[J].begin(); q!=line[J].end(); q++){ if(*q==C){ *q=c; break; } } } //// pop_back //// data.pop_back(); } return *this; }
void zhsmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 246 of file zhsmatrix-io.hpp.
{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 << "#zhsmatrix" << " " << n << std::endl; for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ ofs << it->i << " " << it->j << " " << it->v << std::endl; } ofs.close(); }
void zhsmatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 262 of file zhsmatrix-io.hpp.
References i(), n, put(), and resize().
Referenced by zhsmatrix().
{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 != "zhsmatrix" && id != "#zhsmatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not zhsmatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> n; resize(n); comple val; long i, j, pos, tmp; while(!s.eof()){ s >> i >> j >> val; put(i,j, val); pos =s.tellg(); s >> tmp; s.seekg(pos); } if(!s.eof()){ ERROR_REPORT; std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl << "Most likely, there are too many data components over the context." << std::endl; exit(1); } s.close(); }
void zhsmatrix::clear | ( | ) | [inline] |
zhsmatrix & zhsmatrix::zero | ( | ) | [inline] |
void zhsmatrix::chsign | ( | ) | [inline] |
void zhsmatrix::copy | ( | const zhsmatrix & | mat | ) | [inline] |
make a deep copy of the matrix
Definition at line 30 of file zhsmatrix-misc.hpp.
Referenced by operator=(), and zhsmatrix().
void zhsmatrix::shallow_copy | ( | const _zhsmatrix & | mat | ) | [inline] |
make a shallow copy of the matrix
This function is not designed to be used in project codes.
Definition at line 40 of file zhsmatrix-misc.hpp.
References data, _zhsmatrix::data, line, _zhsmatrix::line, _zhsmatrix::n, n, and _zhsmatrix::nullify().
Referenced by operator=().
zhsmatrix & zhsmatrix::resize | ( | const long & | _n, |
const long | _c = 0 , |
||
const long | _l = 0 |
||
) | [inline] |
resize the matrix
Definition at line 54 of file zhsmatrix-misc.hpp.
References data, i(), line, and n.
Referenced by read().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _n<0 || _c<0 || _l<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl << "Your input was (" << _n << "," << _c << "," << _l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG n =_n; data.resize(0); data.reserve(_c); line.resize(n); for(long i=0; i<n; i++){ line[i].resize(0); line[i].reserve(_l); } return *this; }
void zhsmatrix::stretch | ( | const long & | dn | ) | [inline] |
stretch the matrix size
Definition at line 79 of file zhsmatrix-misc.hpp.
References data, del(), i(), line, and n.
{VERBOSE_REPORT; if(dn==0){ return; } #ifdef CPPL_DEBUG if( n+dn<0 ){ ERROR_REPORT; std::cerr << "The new matrix size must be larger than zero." << std::endl << "Your input was (" << dn << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG n +=dn; if(dn<0){ //// delete components over the new size //// for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data.rend(); it++){ if( long(it->i)>=n ){ del(data.rend()-it-1); } } //// shrink line //// for(long i=0; i<-dn; i++){ line.pop_back(); } } else{//dn>0 //// expand line //// for(long i=0; i<dn; i++){ line.push_back( std::vector<uint32_t>(0) ); } } }
void zhsmatrix::expand | ( | const long & | ) | [inline] |
bool zhsmatrix::isListed | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
check if the component is listed
Definition at line 114 of file zhsmatrix-misc.hpp.
Referenced by put().
{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 const uint32_t ii(std::max(i,j)), jj(std::min(i,j)); for(std::vector<uint32_t>::const_iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if(data[*p].j==jj){ return 1; } } return 0; }
long zhsmatrix::number | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
return the element number of the component
Definition at line 135 of file zhsmatrix-misc.hpp.
Referenced by operator<<().
{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 const uint32_t ii(std::max(i,j)), jj(std::min(i,j)); for(std::vector<uint32_t>::const_iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if(data[*p].j==jj){ return *p; } } return -1; }
void zhsmatrix::checkup | ( | ) | [inline] |
health checkup
Definition at line 251 of file zhsmatrix-misc.hpp.
References i(), imag(), and m.
{VERBOSE_REPORT; //////// complex diagonal //////// for(long i=0; i<m; i++){ if( std::fabs((*this)(i,i).imag()) > DBL_MIN ){ ERROR_REPORT; std::cerr << "Diagonal components of a Hermitian matrix have to be real numbers." << std::endl << "(*this)(" << i << "," << i << ") was a complex number, " << (*this)(i,i) << "." << std::endl; exit(1); } } //////// NOTE //////// std::cerr << "# [NOTE]@zhsmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl; }
_zrovector zhsmatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 159 of file zhsmatrix-misc.hpp.
References _, conj(), data, i(), line, m, n, and zero().
{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 vec( zrovector(n).zero() ); for(std::vector<uint32_t>::const_iterator p=line[_m].begin(); p!=line[_m].end(); p++){ if( long(data[*p].i)==_m ){//i>=j vec(data[*p].j) =data[*p].v; } else{//i<j vec(data[*p].i) =std::conj(data[*p].v); } } return _(vec); }
_zcovector zhsmatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 184 of file zhsmatrix-misc.hpp.
References _, conj(), data, i(), line, m, n, and zero().
{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 vec( zcovector(m).zero() ); for(std::vector<uint32_t>::const_iterator p=line[_n].begin(); p!=line[_n].end(); p++){ if( long(data[*p].i)==_n ){//i<j vec(data[*p].j) =std::conj(data[*p].v); } else{//i>=j vec(data[*p].i) =data[*p].v; } } return _(vec); }
void zhsmatrix::diet | ( | const double | eps = DBL_MIN | ) | [inline] |
erase components less than DBL_MIN
Definition at line 209 of file zhsmatrix-misc.hpp.
zhsmatrix & zhsmatrix::operator= | ( | const _zhsmatrix & | mat | ) | [inline] |
zhsmatrix=_zhsmatrix operator
Definition at line 3 of file zhsmatrix-_zhsmatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
zhsmatrix+=zhsmatrix operator
Definition at line 17 of file zhsmatrix-zhsmatrix.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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } return *this; }
zhsmatrix & zhsmatrix::operator+= | ( | const _zhsmatrix & | mat | ) | [inline] |
zhsmatrix+=_zhsmatrix operator
Definition at line 15 of file zhsmatrix-_zhsmatrix.hpp.
References _zhsmatrix::data, _zhsmatrix::destroy(), n, and _zhsmatrix::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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } mat.destroy(); return *this; }
zhsmatrix-=zhsmatrix operator
Definition at line 37 of file zhsmatrix-zhsmatrix.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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } return *this; }
zhsmatrix & zhsmatrix::operator-= | ( | const _zhsmatrix & | mat | ) | [inline] |
zhsmatrix-=_zhsmatrix operator
Definition at line 36 of file zhsmatrix-_zhsmatrix.hpp.
References _zhsmatrix::data, _zhsmatrix::destroy(), n, and _zhsmatrix::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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } mat.destroy(); return *this; }
zhsmatrix & zhsmatrix::operator*= | ( | const double & | d | ) | [inline] |
zhsmatrix & zhsmatrix::operator/= | ( | const double & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const zhsmatrix & | mat | ||
) | [friend] |
Definition at line 212 of file zhsmatrix-io.hpp.
{VERBOSE_REPORT; for(long i=0; i<mat.n; i++){ for(long j=0; j<mat.n; j++){ if( i >= j ){ long c =mat.number(i,j); if(c<0){ s << " x "; } else{ s << " " << mat.data[c].v << " "; } } else{//i<j long c =mat.number(i,j); if(c<0){ s << "{x}"; } else{ s << "{" << std::conj(mat.data[c].v) << "}"; } } } s << std::endl; } return s; }
_zhsmatrix _ | ( | zhsmatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 233 of file zhsmatrix-misc.hpp.
Referenced by col(), row(), to_zgematrix(), to_zgsmatrix(), and to_zhematrix().
_zhsmatrix t | ( | const zhsmatrix & | mat | ) | [friend] |
return transposed zhsmatrix
Definition at line 3 of file zhsmatrix-calc.hpp.
search the index of element having the largest absolute value in 0-based numbering system
Definition at line 51 of file zhsmatrix-calc.hpp.
return its largest absolute value
Definition at line 67 of file zhsmatrix-calc.hpp.
+zhsmatrix operator
Definition at line 3 of file zhsmatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_zhsmatrix operator- | ( | const zhsmatrix & | mat | ) | [friend] |
-zhsmatrix operator
Definition at line 10 of file zhsmatrix-unary.hpp.
_zgematrix operator+ | ( | const zhsmatrix & | , |
const zgematrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zhsmatrix & | , |
const _zgematrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zhsmatrix & | , |
const zhematrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zhsmatrix & | , |
const _zhematrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zhsmatrix & | , |
const zgbmatrix & | |||
) | [friend] |
_zgematrix operator+ | ( | const zhsmatrix & | , |
const _zgbmatrix & | |||
) | [friend] |
_zgsmatrix operator+ | ( | const zhsmatrix & | , |
const zgsmatrix & | |||
) | [friend] |
_zgsmatrix operator+ | ( | const zhsmatrix & | , |
const _zgsmatrix & | |||
) | [friend] |
_zhsmatrix operator+ | ( | const zhsmatrix & | matA, |
const zhsmatrix & | matB | ||
) | [friend] |
zhsmatrix+zhsmatrix operator
Definition at line 61 of file zhsmatrix-zhsmatrix.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 zhsmatrix newmat(matA); for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) +=it->v; } return _(newmat); }
_zhsmatrix operator+ | ( | const zhsmatrix & | matA, |
const _zhsmatrix & | matB | ||
) | [friend] |
zhsmatrix+_zhsmatrix operator
Definition at line 61 of file zhsmatrix-_zhsmatrix.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 zhsmatrix newmat(matB); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) +=it->v; } return _(newmat); }
_zgematrix operator- | ( | const zhsmatrix & | , |
const zgematrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zhsmatrix & | , |
const _zgematrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zhsmatrix & | , |
const zhematrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zhsmatrix & | , |
const _zhematrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zhsmatrix & | , |
const zgbmatrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zhsmatrix & | , |
const _zgbmatrix & | |||
) | [friend] |
_zgsmatrix operator- | ( | const zhsmatrix & | , |
const zgsmatrix & | |||
) | [friend] |
_zgsmatrix operator- | ( | const zhsmatrix & | , |
const _zgsmatrix & | |||
) | [friend] |
_zhsmatrix operator- | ( | const zhsmatrix & | matA, |
const zhsmatrix & | matB | ||
) | [friend] |
zhsmatrix-zhsmatrix operator
Definition at line 83 of file zhsmatrix-zhsmatrix.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 zhsmatrix newmat(matA); for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) -=it->v; } return _(newmat); }
_zhsmatrix operator- | ( | const zhsmatrix & | matA, |
const _zhsmatrix & | matB | ||
) | [friend] |
zhsmatrix-_zhsmatrix operator
Definition at line 83 of file zhsmatrix-_zhsmatrix.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 zhsmatrix newmat(-matB); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) +=it->v; } return _(newmat); }
_zcovector operator* | ( | const zhsmatrix & | mat, |
const zcovector & | vec | ||
) | [friend] |
zhsmatrix*zcovector operator
Definition at line 3 of file zhsmatrix-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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zcovector newvec(mat.n); newvec.zero(); for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ newvec(it->i) +=it->v*vec(it->j); if(it->i!=it->j){ newvec(it->j) +=std::conj(it->v)*vec(it->i); } } return _(newvec); }
_zcovector operator* | ( | const zhsmatrix & | mat, |
const _zcovector & | vec | ||
) | [friend] |
zhsmatrix*_zcovector operator
Definition at line 3 of file zhsmatrix-_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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zcovector newvec(mat.n); newvec.zero(); for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ newvec(it->i) +=it->v*vec(it->j); if(it->i!=it->j){ newvec(it->j) +=std::conj(it->v)*vec(it->i); } } vec.destroy(); return _(newvec); }
_zgematrix operator* | ( | const zhsmatrix & | , |
const zgematrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zhsmatrix & | , |
const _zgematrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zhsmatrix & | , |
const zhematrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zhsmatrix & | , |
const _zhematrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zhsmatrix & | , |
const zgbmatrix & | |||
) | [friend] |
_zgematrix operator* | ( | const zhsmatrix & | , |
const _zgbmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zhsmatrix & | , |
const zgsmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zhsmatrix & | , |
const _zgsmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zhsmatrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zhsmatrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zhsmatrix operator* | ( | const zhsmatrix & | mat, |
const double & | d | ||
) | [friend] |
zhsmatrix*double operator
Definition at line 27 of file zhsmatrix-double.hpp.
_zgsmatrix operator* | ( | const zhsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
zhsmatrix*complex operator
Definition at line 3 of file zhsmatrix-complex.hpp.
{VERBOSE_REPORT; zgsmatrix newmat( mat.to_zgsmatrix() ); return newmat*d; }
_zhsmatrix operator/ | ( | const zhsmatrix & | mat, |
const double & | d | ||
) | [friend] |
zhsmatrix/double operator
Definition at line 40 of file zhsmatrix-double.hpp.
_zgsmatrix operator/ | ( | const zhsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
zhsmatrix/complex operator
Definition at line 11 of file zhsmatrix-complex.hpp.
{VERBOSE_REPORT; zgsmatrix newmat( mat.to_zgsmatrix() ); return newmat/d; }
_zhsmatrix operator* | ( | const double & | d, |
const zhsmatrix & | mat | ||
) | [friend] |
double*zhsmatrix operator
Definition at line 3 of file double-zhsmatrix.hpp.
_zgsmatrix operator* | ( | const comple & | d, |
const zhsmatrix & | mat | ||
) | [friend] |
complex*zhsmatrix operator
Definition at line 3 of file complex-zhsmatrix.hpp.
{VERBOSE_REPORT; zgsmatrix newmat( mat.to_zgsmatrix() ); return d*newmat; }
long const& zhsmatrix::m |
matrix row size
Definition at line 9 of file zhsmatrix.hpp.
Referenced by checkup(), col(), operator*(), row(), to_zgematrix(), and to_zgsmatrix().
long zhsmatrix::n |
matrix column size
Definition at line 10 of file zhsmatrix.hpp.
Referenced by _(), clear(), col(), copy(), del(), isListed(), number(), operator()(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), resize(), row(), shallow_copy(), stretch(), swap(), to_zgematrix(), to_zgsmatrix(), to_zhematrix(), write(), zero(), and zhsmatrix().
std::vector<zcomponent> zhsmatrix::data |
matrix data
Definition at line 11 of file zhsmatrix.hpp.
Referenced by _(), chsign(), clear(), col(), conj(), copy(), damax(), del(), diet(), idamax(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), put(), resize(), row(), shallow_copy(), stretch(), swap(), t(), to_zgematrix(), to_zgsmatrix(), to_zhematrix(), write(), zero(), zhsmatrix(), and ~zhsmatrix().
std::vector< std::vector<uint32_t> > zhsmatrix::line |
vector of vector to store the entry information of component for each row and column
Definition at line 12 of file zhsmatrix.hpp.
Referenced by _(), clear(), col(), copy(), del(), isListed(), number(), operator()(), put(), resize(), row(), shallow_copy(), stretch(), swap(), zero(), zhsmatrix(), and ~zhsmatrix().