CPPLapack
|
Complex Double-precision General Sparse Matrix Class. More...
#include <zgsmatrix.hpp>
Public Member Functions | |
zgsmatrix () | |
zgsmatrix (const zgsmatrix &) | |
zgsmatrix (const _zgsmatrix &) | |
zgsmatrix (const long &, const long &, const long=0) | |
zgsmatrix (const char *) | |
~zgsmatrix () | |
_zgematrix | to_zgematrix () const |
comple | operator() (const long &, const long &) const |
comple & | operator() (const long &, const long &) |
zgsmatrix & | put (const long &, const long &, const comple &) |
zgsmatrix & | del (const long, const long) |
zgsmatrix & | del (const long) |
void | write (const char *) const |
void | read (const char *) |
void | clear () |
zgsmatrix & | zero () |
void | chsign () |
void | copy (const zgsmatrix &) |
void | shallow_copy (const _zgsmatrix &) |
zgsmatrix & | resize (const long &, const long &, const long=0, const long=0) |
void | stretch (const long &, const long &) |
void | expand (const long &) |
bool | isListed (const long &, const long &) |
long | number (const long &, const long &) |
void | checkup () |
void | diet (const double=DBL_MIN) |
_zrovector | row (const long &) const |
_zcovector | col (const long &) const |
zgsmatrix & | operator= (const zgsmatrix &) |
zgsmatrix & | operator= (const _zgsmatrix &) |
zgsmatrix & | operator+= (const zgsmatrix &) |
zgsmatrix & | operator+= (const _zgsmatrix &) |
zgsmatrix & | operator-= (const zgsmatrix &) |
zgsmatrix & | operator-= (const _zgsmatrix &) |
zgsmatrix & | operator*= (const zgsmatrix &) |
zgsmatrix & | operator*= (const _zgsmatrix &) |
zgsmatrix & | operator*= (const double &) |
zgsmatrix & | operator*= (const comple &) |
zgsmatrix & | operator/= (const double &) |
zgsmatrix & | operator/= (const comple &) |
Public Attributes | |
long | m |
matrix row size | |
long | n |
matrix column size | |
std::vector< zcomponent > | data |
matrix data | |
std::vector< std::vector < uint32_t > > | rows |
array of vector to store the entry information of component for each row | |
std::vector< std::vector < uint32_t > > | cols |
array of vector to store the entry information of component for each column | |
Friends | |
std::ostream & | operator<< (std::ostream &, const zgsmatrix &) |
void | swap (zgsmatrix &, zgsmatrix &) |
_zgsmatrix | _ (zgsmatrix &) |
_zgsmatrix | t (const zgsmatrix &) |
_zgsmatrix | conj (const zgsmatrix &) |
_zgsmatrix | conjt (const zgsmatrix &) |
void | idamax (long &, long &, const zgsmatrix &) |
comple | damax (const zgsmatrix &) |
const zgsmatrix & | operator+ (const zgsmatrix &) |
_zgsmatrix | operator- (const zgsmatrix &) |
_zgematrix | operator+ (const zgsmatrix &, const zgematrix &) |
_zgematrix | operator+ (const zgsmatrix &, const _zgematrix &) |
_zgematrix | operator+ (const zgsmatrix &, const zhematrix &) |
_zgematrix | operator+ (const zgsmatrix &, const _zhematrix &) |
_zgematrix | operator+ (const zgsmatrix &, const zgbmatrix &) |
_zgematrix | operator+ (const zgsmatrix &, const _zgbmatrix &) |
_zgsmatrix | operator+ (const zgsmatrix &, const zgsmatrix &) |
_zgsmatrix | operator+ (const zgsmatrix &, const _zgsmatrix &) |
_zgsmatrix | operator+ (const zgsmatrix &, const zhsmatrix &) |
_zgsmatrix | operator+ (const zgsmatrix &, const _zhsmatrix &) |
_zgematrix | operator- (const zgsmatrix &, const zgematrix &) |
_zgematrix | operator- (const zgsmatrix &, const _zgematrix &) |
_zgematrix | operator- (const zgsmatrix &, const zhematrix &) |
_zgematrix | operator- (const zgsmatrix &, const _zhematrix &) |
_zgematrix | operator- (const zgsmatrix &, const zgbmatrix &) |
_zgematrix | operator- (const zgsmatrix &, const _zgbmatrix &) |
_zgsmatrix | operator- (const zgsmatrix &, const zgsmatrix &) |
_zgsmatrix | operator- (const zgsmatrix &, const _zgsmatrix &) |
_zgsmatrix | operator- (const zgsmatrix &, const zhsmatrix &) |
_zgsmatrix | operator- (const zgsmatrix &, const _zhsmatrix &) |
_zcovector | operator* (const zgsmatrix &, const zcovector &) |
_zcovector | operator* (const zgsmatrix &, const _zcovector &) |
_zgematrix | operator* (const zgsmatrix &, const zgematrix &) |
_zgematrix | operator* (const zgsmatrix &, const _zgematrix &) |
_zgematrix | operator* (const zgsmatrix &, const zhematrix &) |
_zgematrix | operator* (const zgsmatrix &, const _zhematrix &) |
_zgematrix | operator* (const zgsmatrix &, const zgbmatrix &) |
_zgematrix | operator* (const zgsmatrix &, const _zgbmatrix &) |
_zgsmatrix | operator* (const zgsmatrix &, const zgsmatrix &) |
_zgsmatrix | operator* (const zgsmatrix &, const _zgsmatrix &) |
_zgsmatrix | operator* (const zgsmatrix &, const zhsmatrix &) |
_zgsmatrix | operator* (const zgsmatrix &, const _zhsmatrix &) |
_zgsmatrix | operator* (const zgsmatrix &, const double &) |
_zgsmatrix | operator* (const zgsmatrix &, const comple &) |
_zgsmatrix | operator/ (const zgsmatrix &, const double &) |
_zgsmatrix | operator/ (const zgsmatrix &, const comple &) |
_zgsmatrix | operator* (const double &, const zgsmatrix &) |
_zgsmatrix | operator* (const comple &, const zgsmatrix &) |
Complex Double-precision General Sparse Matrix Class.
Definition at line 3 of file zgsmatrix.hpp.
zgsmatrix::zgsmatrix | ( | ) | [inline] |
zgsmatrix::zgsmatrix | ( | const zgsmatrix & | mat | ) | [inline] |
zgsmatrix::zgsmatrix | ( | const _zgsmatrix & | mat | ) | [inline] |
zgsmatrix constructor to cast _zgsmatrix
Definition at line 31 of file zgsmatrix-constructor.hpp.
References cols, _zgsmatrix::cols, _zgsmatrix::data, data, m, _zgsmatrix::m, _zgsmatrix::n, n, _zgsmatrix::nullify(), rows, and _zgsmatrix::rows.
zgsmatrix::zgsmatrix | ( | const long & | _m, |
const long & | _n, | ||
const long | _c = 0 |
||
) | [inline] |
zgsmatrix constructor with size specification
Definition at line 52 of file zgsmatrix-constructor.hpp.
References cols, data, m, n, and rows.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 || _c<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl << "Your input was (" << _m << "," << _n << "," << _c << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// initialize //////// m =_m; n =_n; data.resize(0); data.reserve(_c); rows.resize(m); cols.resize(n); }
zgsmatrix::zgsmatrix | ( | const char * | filename | ) | [inline] |
zgsmatrix::~zgsmatrix | ( | ) | [inline] |
_zgematrix zgsmatrix::to_zgematrix | ( | ) | const [inline] |
convert to _zgematrix
Definition at line 3 of file zgsmatrix-cast.hpp.
References _, data, zcomponent::i, zcomponent::j, m, n, zcomponent::v, and zero().
Referenced by operator+(), and operator-().
comple zgsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 3 of file zgsmatrix-io.hpp.
References data, i(), m, n, and rows.
{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 //// search (i,j) component //// for(std::vector<uint32_t>::const_iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if(long(data[*p].j)==j){ return data[*p].v; } } //// (i,j) component was not found //// return comple(0.0,0.0); }
comple & zgsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for const object
Definition at line 25 of file zgsmatrix-io.hpp.
References cols, data, i(), m, n, and rows.
{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 //////// search (i,j) component //////// for(std::vector<uint32_t>::iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if(long(data[*p].j)==j){ return data[*p].v; } } //////// (i,j) component not found //////// rows[i].push_back(data.size()); cols[j].push_back(data.size()); data.push_back( zcomponent(i,j, comple(0.,0.)) ); return data.back().v; }
zgsmatrix & zgsmatrix::put | ( | const long & | i, |
const long & | j, | ||
const comple & | v | ||
) | [inline] |
put value without isListed check
Definition at line 54 of file zgsmatrix-io.hpp.
References cols, data, i(), isListed(), m, n, and rows.
Referenced by read(), _dgsmatrix::to_zgsmatrix(), _zhsmatrix::to_zgsmatrix(), dgsmatrix::to_zgsmatrix(), and zhsmatrix::to_zgsmatrix().
{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); } 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 //// rows[i].push_back(data.size()); cols[j].push_back(data.size()); data.push_back(zcomponent(i,j,v)); return *this; }
zgsmatrix & zgsmatrix::del | ( | const long | i, |
const long | j | ||
) | [inline] |
delete the entry of a component
Definition at line 86 of file zgsmatrix-io.hpp.
References cols, data, i(), m, n, and rows.
Referenced by diet(), and stretch().
{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 //// search (i,j) component //// for(std::vector<uint32_t>::iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if(long(data[*p].j)==j){//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 //// rows[i].erase(p); for(std::vector<uint32_t>::iterator q=cols[j].begin(); q!=cols[j].end(); q++){ if(*q==c){ cols[j].erase(q); break; } } //// modify the entry of translated component //// long I(data[c].i), J(data[c].j); for(std::vector<uint32_t>::iterator q=rows[I].begin(); q!=rows[I].end(); q++){ if(*q==C){ *q=c; break; } } for(std::vector<uint32_t>::iterator q=cols[J].begin(); q!=cols[J].end(); q++){ if(*q==C){ *q=c; break; } } return *this; } } #ifdef CPPL_DEBUG std::cerr << "# [NOTE] zgsmatrix::del(long&, long&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; #endif//CPPL_DEBUG return *this; }
zgsmatrix & zgsmatrix::del | ( | const long | c | ) | [inline] |
delete the entry of an element
Definition at line 135 of file zgsmatrix-io.hpp.
References cols, data, i(), and rows.
{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=rows[i].begin(); q!=rows[i].end(); q++){ if(long(*q)==c){ rows[i].erase(q); break; } } for(std::vector<uint32_t>::iterator q=cols[j].begin(); q!=cols[j].end(); q++){ if(long(*q)==c){ cols[j].erase(q); break; } } data.pop_back(); } else{//if 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(); //// remove entry of component //// for(std::vector<uint32_t>::iterator q=rows[i].begin(); q!=rows[i].end(); q++){ if(long(*q)==c){ rows[i].erase(q); break; } } for(std::vector<uint32_t>::iterator q=cols[j].begin(); q!=cols[j].end(); q++){ if(long(*q)==c){ cols[j].erase(q); break; } } //// modify the entry of translated component //// for(std::vector<uint32_t>::iterator q=rows[I].begin(); q!=rows[I].end(); q++){ if(*q==C){ *q=c; break; } } for(std::vector<uint32_t>::iterator q=cols[J].begin(); q!=cols[J].end(); q++){ if(*q==C){ *q=c; break; } } //// pop_back //// data.pop_back(); } return *this; }
void zgsmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 210 of file zgsmatrix-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 << "#zgsmatrix" << " " << m << " " << 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 zgsmatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 226 of file zgsmatrix-io.hpp.
References i(), m, n, put(), and resize().
Referenced by zgsmatrix().
{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 != "zgsmatrix" && id != "#zgsmatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not zgsmatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> m >> n; resize(m, 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 zgsmatrix::clear | ( | ) | [inline] |
zgsmatrix & zgsmatrix::zero | ( | ) | [inline] |
change the matrix into a zero matrix
Definition at line 14 of file zgsmatrix-misc.hpp.
References cols, data, i(), m, n, and rows.
Referenced by col(), row(), to_zgematrix(), _zhsmatrix::to_zgsmatrix(), and zhsmatrix::to_zgsmatrix().
void zgsmatrix::chsign | ( | ) | [inline] |
change sign(+/-) of the matrix
Definition at line 24 of file zgsmatrix-misc.hpp.
References data.
Referenced by operator-().
void zgsmatrix::copy | ( | const zgsmatrix & | mat | ) | [inline] |
void zgsmatrix::shallow_copy | ( | const _zgsmatrix & | mat | ) | [inline] |
make a shallow copy of the matrix
This function is not designed to be used in project codes.
Definition at line 45 of file zgsmatrix-misc.hpp.
References cols, _zgsmatrix::cols, _zgsmatrix::data, data, m, _zgsmatrix::m, _zgsmatrix::n, n, _zgsmatrix::nullify(), rows, and _zgsmatrix::rows.
Referenced by operator=().
zgsmatrix & zgsmatrix::resize | ( | const long & | _m, |
const long & | _n, | ||
const long | _c = 0 , |
||
const long | _l = 0 |
||
) | [inline] |
resize the matrix
Definition at line 62 of file zgsmatrix-misc.hpp.
References cols, data, i(), m, n, and rows.
Referenced by read().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( _m<0 || _n<0 || _c<0 ){ ERROR_REPORT; std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl << "Your input was (" << _m << "," << _n << "," << _c << "," << _l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG m =_m; n =_n; data.resize(0); data.reserve(_c); rows.resize(m); for(long i=0; i<m; i++){ rows[i].resize(0); rows[i].reserve(_l); } cols.resize(n); for(long i=0; i<n; i++){ cols[i].resize(0); cols[i].reserve(_l); } return *this; }
void zgsmatrix::stretch | ( | const long & | dm, |
const long & | dn | ||
) | [inline] |
stretch the matrix size
Definition at line 93 of file zgsmatrix-misc.hpp.
References cols, data, del(), i(), m, n, and rows.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( m+dm<0 || n+dn<0 ){ ERROR_REPORT; std::cerr << "The new matrix size must be larger than zero. " << std::endl << "Your input was (" << dm << ", " << dn << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// zero //////// if(dm==0 && dn==0){ return; } //////// non-zero //////// m +=dm; n +=dn; //// for rows //// if(dm<0){ //// delete components over the new size //// for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data.rend(); it++){ if( long(it->i)>=m ){ del(data.rend()-it-1); } } //// shrink rows //// for(long i=0; i<-dm; i++){ rows.pop_back(); } } else{//dm>0 //// expand rows //// for(long i=0; i<dm; i++){ rows.push_back( std::vector<uint32_t>(0) ); } } //// for cols //// 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->j)>=n ){ del(data.rend()-it-1); } } for(long j=0; j<-dn; j++){ cols.pop_back(); } } else{//dn>0 //// expand cols //// for(long j=0; j<dn; j++){ cols.push_back( std::vector<uint32_t>(0) ); } } }
void zgsmatrix::expand | ( | const long & | ) | [inline] |
bool zgsmatrix::isListed | ( | const long & | i, |
const long & | j | ||
) | [inline] |
check if the component is listed
Definition at line 149 of file zgsmatrix-misc.hpp.
References data, i(), m, n, and rows.
Referenced by put().
{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 for(std::vector<uint32_t>::const_iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if( long(data[*p].j)==j ){ return 1; } } return 0; }
long zgsmatrix::number | ( | const long & | i, |
const long & | j | ||
) | [inline] |
return the element number of the component
Definition at line 169 of file zgsmatrix-misc.hpp.
References data, i(), m, n, and rows.
{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 for(std::vector<uint32_t>::iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if( long(data[*p].j)==j ){ return *p; } } return -1; }
void zgsmatrix::checkup | ( | ) | [inline] |
health checkup
Definition at line 198 of file zgsmatrix-misc.hpp.
{VERBOSE_REPORT; //////////////// data //////////////// //////// check i,j //////// for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ if( long(it->i)>=m || long(it->j)>=n ){ ERROR_REPORT; std::cerr << "A component, (" << it->i << ", " << it->j << "), is out of matrix size." << std::endl; exit(1); } } //////// check double listing //////// //////////////// rows //////////////// //////////////// cols //////////////// //////////////// NOTE //////////////// std::cerr << "# [NOTE] zgsmatrix::checkup(): This sparse matrix is fine." << std::endl; }
void zgsmatrix::diet | ( | const double | eps = DBL_MIN | ) | [inline] |
erase components less than DBL_MIN
Definition at line 189 of file zgsmatrix-misc.hpp.
_zrovector zgsmatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 224 of file zgsmatrix-misc.hpp.
References _, data, m, n, rows, 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=rows[_m].begin(); p!=rows[_m].end(); p++){ vec(data[*p].j) =data[*p].v; } return _(vec); }
_zcovector zgsmatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 244 of file zgsmatrix-misc.hpp.
References _, cols, data, i(), 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=cols[_n].begin(); p!=cols[_n].end(); p++){ vec(data[*p].i) =data[*p].v; } return _(vec); }
zgsmatrix & zgsmatrix::operator= | ( | const _zgsmatrix & | mat | ) | [inline] |
zgsmatrix=_zgsmatrix operator
Definition at line 3 of file zgsmatrix-_zgsmatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
zgsmatrix+=zgsmatrix operator
Definition at line 17 of file zgsmatrix-zgsmatrix.hpp.
{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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } return *this; }
zgsmatrix & zgsmatrix::operator+= | ( | const _zgsmatrix & | mat | ) | [inline] |
zgsmatrix+=_zgsmatrix operator
Definition at line 15 of file zgsmatrix-_zgsmatrix.hpp.
References _zgsmatrix::data, _zgsmatrix::destroy(), _zgsmatrix::m, m, n, and _zgsmatrix::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(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; }
zgsmatrix-=zgsmatrix operator
Definition at line 36 of file zgsmatrix-zgsmatrix.hpp.
{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(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } return *this; }
zgsmatrix & zgsmatrix::operator-= | ( | const _zgsmatrix & | mat | ) | [inline] |
zgsmatrix-=_zgsmatrix operator
Definition at line 35 of file zgsmatrix-_zgsmatrix.hpp.
References _zgsmatrix::data, _zgsmatrix::destroy(), _zgsmatrix::m, m, n, and _zgsmatrix::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(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; }
zgsmatrix*=zgsmatrix operator
Definition at line 55 of file zgsmatrix-zgsmatrix.hpp.
References data, m, n, rows, 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 zgsmatrix newmat(m, mat.n); for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ long k(it->j); std::vector<uint32_t>::const_iterator p; for(p=mat.rows[k].begin(); p!=mat.rows[k].end(); p++){ newmat(it->i,mat.data[*p].j) +=it->v*mat.data[*p].v; } } swap(*this,newmat); return *this; }
zgsmatrix & zgsmatrix::operator*= | ( | const _zgsmatrix & | mat | ) | [inline] |
zgsmatrix*=_zgsmatrix operator
Definition at line 55 of file zgsmatrix-_zgsmatrix.hpp.
References data, _zgsmatrix::data, _zgsmatrix::destroy(), _zgsmatrix::m, m, n, _zgsmatrix::n, _zgsmatrix::rows, 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 zgsmatrix newmat( m, mat.n, 0 ); for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ long k(it->j); std::vector<uint32_t>::iterator p; for(p=mat.rows[k].begin(); p!=mat.rows[k].end(); p++){ newmat(it->i,mat.data[*p].j) += it->v*mat.data[*p].v; } } swap(*this,newmat); mat.destroy(); return *this; }
zgsmatrix & zgsmatrix::operator*= | ( | const double & | d | ) | [inline] |
zgsmatrix & zgsmatrix::operator*= | ( | const comple & | d | ) | [inline] |
zgsmatrix & zgsmatrix::operator/= | ( | const double & | d | ) | [inline] |
zgsmatrix & zgsmatrix::operator/= | ( | const comple & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const zgsmatrix & | mat | ||
) | [friend] |
Definition at line 188 of file zgsmatrix-io.hpp.
{VERBOSE_REPORT; for(long i=0; i<mat.m; i++){ for(long j=0; j<mat.n; j++){ std::vector<uint32_t>::const_iterator q; for(q=mat.rows[i].begin(); q!=mat.rows[i].end(); q++){ if(long(mat.data[*q].j)==j){ break; } } if(q!=mat.rows[i].end()){ s << " " << mat.data[*q].v; } else{ s << " x"; } } s << std::endl; } return s; }
_zgsmatrix _ | ( | zgsmatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 279 of file zgsmatrix-misc.hpp.
Referenced by col(), row(), and to_zgematrix().
_zgsmatrix t | ( | const zgsmatrix & | mat | ) | [friend] |
_zgsmatrix conj | ( | const zgsmatrix & | mat | ) | [friend] |
return its conjugate matrix
Definition at line 21 of file zgsmatrix-calc.hpp.
_zgsmatrix conjt | ( | const zgsmatrix & | mat | ) | [friend] |
return its conjugate transposed matrix
Definition at line 34 of file zgsmatrix-calc.hpp.
search the index of element having the largest absolute value in 0-based numbering system
Definition at line 53 of file zgsmatrix-calc.hpp.
return its largest absolute value
Definition at line 69 of file zgsmatrix-calc.hpp.
+zgsmatrix operator
Definition at line 3 of file zgsmatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_zgsmatrix operator- | ( | const zgsmatrix & | mat | ) | [friend] |
-zgsmatrix operator
Definition at line 10 of file zgsmatrix-unary.hpp.
_zgematrix operator+ | ( | const zgsmatrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgsmatrix+zgematrix operator
Definition at line 3 of file zgsmatrix-zgematrix.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(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 zgsmatrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgsmatrix+_zgematrix operator
Definition at line 3 of file zgsmatrix-_zgematrix.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 for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ matB(it->i,it->j) += it->v; } return matB; }
_zgematrix operator+ | ( | const zgsmatrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgsmatrix+zhematrix operator
Definition at line 3 of file zgsmatrix-zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.n || 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.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matB.to_zgematrix() ); 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 zgsmatrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgsmatrix+_zhematrix operator
Definition at line 3 of file zgsmatrix-_zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.n || 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.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat( matB.to_zgematrix() ); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } matB.destroy(); return _(newmat); }
_zgematrix operator+ | ( | const zgsmatrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix+zgbmatrix operator
Definition at line 3 of file zgsmatrix-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.to_zgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j) +=matB(i,j); } } return _(newmat); }
_zgematrix operator+ | ( | const zgsmatrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix+_zgbmatrix operator
Definition at line 3 of file zgsmatrix-_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.to_zgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j) +=matB(i,j); } } matB.destroy(); return _(newmat); }
_zgsmatrix operator+ | ( | const zgsmatrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix+zgsmatrix operator
Definition at line 86 of file zgsmatrix-zgsmatrix.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 zgsmatrix 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); }
_zgsmatrix operator+ | ( | const zgsmatrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix+_zgsmatrix operator
Definition at line 87 of file zgsmatrix-_zgsmatrix.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 zgsmatrix 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); }
_zgsmatrix operator+ | ( | const zgsmatrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgsmatrix operator+ | ( | const zgsmatrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zgematrix operator- | ( | const zgsmatrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgsmatrix-zgematrix operator
Definition at line 23 of file zgsmatrix-zgematrix.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(-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 zgsmatrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgsmatrix-_zgematrix operator
Definition at line 22 of file zgsmatrix-_zgematrix.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 //// change sign //// for(long i=0; i<matB.m*matB.n; i++){ matB.array[i]=-matB.array[i]; } //// add //// for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ matB(it->i,it->j) += it->v; } return matB; }
_zgematrix operator- | ( | const zgsmatrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgsmatrix-zhematrix operator
Definition at line 24 of file zgsmatrix-zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.n || 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 //// shallow copy to zgematrix //// zgematrix newmat( (-matB).to_zgematrix() ); //// add //// 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 zgsmatrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgsmatrix-_zhematrix operator
Definition at line 25 of file zgsmatrix-_zhematrix.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(matA.m!=matB.n || 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( (-matB).to_zgematrix() ); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } matB.destroy(); return _(newmat); }
_zgematrix operator- | ( | const zgsmatrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix-zgbmatrix operator
Definition at line 27 of file zgsmatrix-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.to_zgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j) -=matB(i,j); } } return _(newmat); }
_zgematrix operator- | ( | const zgsmatrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix-_zgbmatrix operator
Definition at line 28 of file zgsmatrix-_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.to_zgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j) -=matB(i,j); } } matB.destroy(); return _(newmat); }
_zgsmatrix operator- | ( | const zgsmatrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix-zgsmatrix operator
Definition at line 106 of file zgsmatrix-zgsmatrix.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 zgsmatrix 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); }
_zgsmatrix operator- | ( | const zgsmatrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix-_zgsmatrix operator
Definition at line 107 of file zgsmatrix-_zgsmatrix.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 zgsmatrix newmat(matB); newmat.chsign(); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } return _(newmat); }
_zgsmatrix operator- | ( | const zgsmatrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgsmatrix operator- | ( | const zgsmatrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zcovector operator* | ( | const zgsmatrix & | mat, |
const zcovector & | vec | ||
) | [friend] |
zgsmatrix*zcovector operator
Definition at line 3 of file zgsmatrix-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); 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); } return _(newvec); }
_zcovector operator* | ( | const zgsmatrix & | mat, |
const _zcovector & | vec | ||
) | [friend] |
zgsmatrix*_zcovector operator
Definition at line 3 of file zgsmatrix-_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); 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); } vec.destroy(); return _(newvec); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const zgematrix & | matB | ||
) | [friend] |
zgsmatrix*zgematrix operator
Definition at line 43 of file zgsmatrix-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.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=0; j<matB.n; j++){ newmat(it->i,j) += it->v*matB(it->j,j); } } return _(newmat); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const _zgematrix & | matB | ||
) | [friend] |
zgsmatrix*_zgematrix operator
Definition at line 48 of file zgsmatrix-_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.n << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=0; j<matB.n; j++){ newmat(it->i,j) += it->v *matB(it->j,j); } } matB.destroy(); return _(newmat); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const zhematrix & | matB | ||
) | [friend] |
zgsmatrix*zhematrix operator
Definition at line 48 of file zgsmatrix-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, matB.n); newmat.zero(); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long i=0; i<matB.n; i++){ newmat(it->i,i) += it->v*matB(it->j,i); } } return _(newmat); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const _zhematrix & | matB | ||
) | [friend] |
zgsmatrix*_zhematrix operator
Definition at line 48 of file zgsmatrix-_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, matB.n); newmat.zero(); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long i=0; i<matB.n; i++){ newmat(it->i,i) += it->v*matB(it->j,i); } } matB.destroy(); return _(newmat); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix*zgbmatrix operator
Definition at line 51 of file zgsmatrix-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(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=std::max(0l,long(it->j)-matB.kl); j<std::min(matB.n,long(it->j)+matB.ku+1); j++){ newmat(it->i,j) += it->v*matB(it->j,j); } } return _(newmat); }
_zgematrix operator* | ( | const zgsmatrix & | matA, |
const _zgbmatrix & | matB | ||
) | [friend] |
zgsmatrix*_zgbmatrix operator
Definition at line 53 of file zgsmatrix-_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(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=std::max(0l,long(it->j)-matB.kl); j<std::min(matB.n,long(it->j)+matB.ku+1); j++){ newmat(it->i,j) += it->v*matB(it->j,j); } } matB.destroy(); return _(newmat); }
_zgsmatrix operator* | ( | const zgsmatrix & | matA, |
const zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix*zgsmatrix operator
Definition at line 126 of file zgsmatrix-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.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgsmatrix newmat(matA.m, matB.n); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ long k(it->j); std::vector<uint32_t>::const_iterator p; for(p=matB.rows[k].begin(); p!=matB.rows[k].end(); p++){ newmat(it->i,matB.data[*p].j) +=it->v*matB.data[*p].v; } } return _(newmat); }
_zgsmatrix operator* | ( | const zgsmatrix & | matA, |
const _zgsmatrix & | matB | ||
) | [friend] |
zgsmatrix*_zgsmatrix operator
Definition at line 128 of file zgsmatrix-_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.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG zgsmatrix newmat(matA.m, matB.n); for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ long k(it->j); std::vector<uint32_t>::iterator p; for(p=matB.rows[k].begin(); p!=matB.rows[k].end(); p++){ newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; } } matB.destroy(); return _(newmat); }
_zgsmatrix operator* | ( | const zgsmatrix & | , |
const zhsmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zgsmatrix & | , |
const _zhsmatrix & | |||
) | [friend] |
_zgsmatrix operator* | ( | const zgsmatrix & | mat, |
const double & | d | ||
) | [friend] |
zgsmatrix*double operator
Definition at line 27 of file zgsmatrix-double.hpp.
_zgsmatrix operator* | ( | const zgsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
zgsmatrix*comple operator
Definition at line 27 of file zgsmatrix-complex.hpp.
_zgsmatrix operator/ | ( | const zgsmatrix & | mat, |
const double & | d | ||
) | [friend] |
zgsmatrix/double operator
Definition at line 38 of file zgsmatrix-double.hpp.
_zgsmatrix operator/ | ( | const zgsmatrix & | mat, |
const comple & | d | ||
) | [friend] |
zgsmatrix/comple operator
Definition at line 38 of file zgsmatrix-complex.hpp.
_zgsmatrix operator* | ( | const double & | d, |
const zgsmatrix & | mat | ||
) | [friend] |
double*zgsmatrix operator
Definition at line 3 of file double-zgsmatrix.hpp.
_zgsmatrix operator* | ( | const comple & | d, |
const zgsmatrix & | mat | ||
) | [friend] |
complex*zgsmatrix operator
Definition at line 3 of file complex-zgsmatrix.hpp.
long zgsmatrix::m |
matrix row size
Definition at line 9 of file zgsmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), resize(), row(), shallow_copy(), stretch(), swap(), to_zgematrix(), write(), zero(), and zgsmatrix().
long zgsmatrix::n |
matrix column size
Definition at line 10 of file zgsmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), resize(), row(), shallow_copy(), stretch(), swap(), to_zgematrix(), write(), zero(), and zgsmatrix().
std::vector<zcomponent> zgsmatrix::data |
matrix data
Definition at line 11 of file zgsmatrix.hpp.
Referenced by _(), checkup(), chsign(), clear(), col(), conj(), conjt(), 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(), write(), zero(), zgsmatrix(), and ~zgsmatrix().
std::vector< std::vector<uint32_t> > zgsmatrix::rows |
array of vector to store the entry information of component for each row
Definition at line 12 of file zgsmatrix.hpp.
Referenced by _(), clear(), conjt(), copy(), del(), isListed(), number(), operator()(), operator*(), operator*=(), operator<<(), put(), resize(), row(), shallow_copy(), stretch(), swap(), t(), zero(), zgsmatrix(), and ~zgsmatrix().
std::vector< std::vector<uint32_t> > zgsmatrix::cols |
array of vector to store the entry information of component for each column
Definition at line 13 of file zgsmatrix.hpp.
Referenced by _(), clear(), col(), conjt(), copy(), del(), operator()(), put(), resize(), shallow_copy(), stretch(), swap(), t(), zero(), zgsmatrix(), and ~zgsmatrix().