CPPLapack
|
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class More...
#include <_zhsmatrix.hpp>
(DO NOT USE) Smart-temporary 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 | ( | ) | [inline] |
_zhsmatrix destructor
Definition at line 31 of file _zhsmatrix-constructor.hpp.
_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 18 of file _zhsmatrix-cast.hpp.
References _(), data, destroy(), n, and zhematrix::zero().
_zgsmatrix _zhsmatrix::to_zgsmatrix | ( | ) | const [inline] |
convert to _zgsmatrix
Definition at line 33 of file _zhsmatrix-cast.hpp.
References _(), conj(), data, destroy(), 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); }
void _zhsmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 65 of file _zhsmatrix-io.hpp.
References data, destroy(), and n.
{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(); destroy(); }
void _zhsmatrix::nullify | ( | ) | const [inline] |
nullify all the matrix data
Definition at line 3 of file _zhsmatrix-misc.hpp.
Referenced by _zhsmatrix(), zhsmatrix::shallow_copy(), and zhsmatrix::zhsmatrix().
void _zhsmatrix::destroy | ( | ) | const [inline] |
destroy all the matrix data
Definition at line 12 of file _zhsmatrix-misc.hpp.
Referenced by damax(), idamax(), operator*(), operator+(), zhsmatrix::operator+=(), operator-(), zhsmatrix::operator-=(), operator<<(), to_zgematrix(), to_zgsmatrix(), to_zhematrix(), and write().
std::ostream& operator<< | ( | std::ostream & | s, |
const _zhsmatrix & | mat | ||
) | [friend] |
Definition at line 32 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 ){ std::vector<uint32_t>::iterator q; for(q=mat.line[i].begin(); q!=mat.line[i].end(); q++){ if( long(mat.data[*q].j)==j ){ break; } } if(q!=mat.line[i].end()){ s << " " << mat.data[*q].v << " "; } else{ s << " x "; } } else{//i<j std::vector<uint32_t>::iterator q; for(q=mat.line[i].begin(); q!=mat.line[i].end(); q++){ if( long(mat.data[*q].j)==j ){ break; } } if(q!=mat.line[i].end()){ s << "{" << mat.data[*q].v << "}"; } else{ s << "{x}"; } } } s << std::endl; } mat.destroy(); return s; }
_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.
const _zhsmatrix& operator+ | ( | const _zhsmatrix & | mat | ) | [friend] |
+_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 3 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 3 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; } matB.destroy(); 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 25 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 26 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; } matB.destroy(); 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); } } mat.destroy(); 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); } } mat.destroy(); 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 3 of file _zhsmatrix-double.hpp.
_zgsmatrix operator* | ( | const _zhsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
_zhsmatrix*comple 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 13 of file _zhsmatrix-double.hpp.
_zgsmatrix operator/ | ( | const _zhsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
_zhsmatrix/comple 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 [mutable] |
matrix row size
Definition at line 9 of file _zhsmatrix.hpp.
Referenced by operator*(), to_zgematrix(), and to_zgsmatrix().
long _zhsmatrix::n [mutable] |
matrix column size
Definition at line 10 of file _zhsmatrix.hpp.
Referenced by _(), _zhsmatrix(), nullify(), operator()(), operator*(), operator+(), zhsmatrix::operator+=(), operator-(), zhsmatrix::operator-=(), operator<<(), zhsmatrix::shallow_copy(), to_zgematrix(), to_zgsmatrix(), to_zhematrix(), write(), and zhsmatrix::zhsmatrix().
std::vector<zcomponent> _zhsmatrix::data [mutable] |
matrix data
Definition at line 11 of file _zhsmatrix.hpp.
Referenced by _(), _zhsmatrix(), conj(), damax(), destroy(), idamax(), nullify(), operator()(), operator*(), operator+(), zhsmatrix::operator+=(), operator-(), zhsmatrix::operator-=(), operator/(), operator<<(), zhsmatrix::shallow_copy(), t(), to_zgematrix(), to_zgsmatrix(), to_zhematrix(), write(), zhsmatrix::zhsmatrix(), and ~_zhsmatrix().
std::vector< std::vector<uint32_t> > _zhsmatrix::line [mutable] |
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 _(), _zhsmatrix(), destroy(), nullify(), operator()(), operator<<(), zhsmatrix::shallow_copy(), zhsmatrix::zhsmatrix(), and ~_zhsmatrix().