CPPLapack
|
Real Double-precision Symmetric Sparse Matrix Class. More...
#include <dssmatrix.hpp>
Real Double-precision Symmetric Sparse Matrix Class.
Definition at line 3 of file dssmatrix.hpp.
dssmatrix::dssmatrix | ( | ) | [inline] |
dssmatrix::dssmatrix | ( | const dssmatrix & | mat | ) | [inline] |
dssmatrix::dssmatrix | ( | const _dssmatrix & | mat | ) | [inline] |
dssmatrix constructor to cast _dssmatrix
Definition at line 28 of file dssmatrix-constructor.hpp.
References data, _dssmatrix::data, line, _dssmatrix::line, _dssmatrix::n, n, and _dssmatrix::nullify().
dssmatrix::dssmatrix | ( | const long & | _n, |
const long | _c = 0 |
||
) | [inline] |
dssmatrix constructor with size specification
Definition at line 47 of file dssmatrix-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); }
dssmatrix::dssmatrix | ( | const char * | filename | ) | [inline] |
dssmatrix::~dssmatrix | ( | ) | [inline] |
_zhsmatrix dssmatrix::to_zhsmatrix | ( | ) | const [inline] |
cast to _zhsmatrix
Definition at line 3 of file dssmatrix-cast.hpp.
References _, data, n, and zhsmatrix::put().
_dgematrix dssmatrix::to_dgematrix | ( | ) | const [inline] |
convert to _dgematrix
Definition at line 19 of file dssmatrix-cast.hpp.
References _, data, m, n, and dgematrix::zero().
_dsymatrix dssmatrix::to_dsymatrix | ( | ) | const [inline] |
convert to _dsymatrix
Definition at line 33 of file dssmatrix-cast.hpp.
References _, data, n, and dsymatrix::zero().
_dgsmatrix dssmatrix::to_dgsmatrix | ( | ) | const [inline] |
convert to _dgsmatrix
Definition at line 46 of file dssmatrix-cast.hpp.
References _, data, m, n, dgsmatrix::put(), and dgsmatrix::zero().
double dssmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 3 of file dssmatrix-io.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || n<=i || n<=j ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //// 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].i==ii && data[*p].j==jj){ return data[*p].v; } } //// (i,j) component was not found //// return 0.0; }
double & dssmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for const object
Definition at line 26 of file dssmatrix-io.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if( i<0 || j<0 || n<=i || n<=j ){ ERROR_REPORT; std::cerr << "The required component is out of the matrix size." << std::endl << "Your input was (" << i << "," << j << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG //////// search (i,j) component //////// const uint32_t ii(std::max(i,j)), jj(std::min(i,j)); for(std::vector<uint32_t>::iterator p=line[ii].begin(); p!=line[ii].end(); p++){ if(data[*p].i==ii && data[*p].j==jj){ return data[*p].v; } } //////// (i,j) component not found //////// line[ii].push_back(data.size()); if(i!=j){//off-diagonal line[jj].push_back(data.size()); } data.push_back(dcomponent(ii,jj,0.)); return data.back().v; }
dssmatrix & dssmatrix::put | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
put value with volume cheack without isListed check
Definition at line 58 of file dssmatrix-io.hpp.
References data, isListed(), line, and n.
Referenced by operator*(), and read().
{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(dcomponent(ii,jj,v)); return *this; }
dssmatrix & dssmatrix::del | ( | const long | i, |
const long | j | ||
) | [inline] |
delete the entry of a component
Definition at line 92 of file dssmatrix-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]@dssmatrix::del(long&, long&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; #endif//CPPL_DEBUG return *this; }
dssmatrix & dssmatrix::del | ( | const long | c | ) | [inline] |
delete the entry of an element
Definition at line 147 of file dssmatrix-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 dssmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 244 of file dssmatrix-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 << "#dssmatrix" << " " << n << std::endl; for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ ofs << it->i << " " << it->j << " " << it->v << std::endl; } ofs.close(); }
void dssmatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 261 of file dssmatrix-io.hpp.
References i(), n, put(), and resize().
Referenced by dssmatrix().
{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 != "dssmatrix" && id != "#dssmatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not dssmatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> n; resize(n); double 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 dssmatrix::clear | ( | ) | [inline] |
dssmatrix & dssmatrix::zero | ( | ) | [inline] |
void dssmatrix::chsign | ( | ) | [inline] |
void dssmatrix::copy | ( | const dssmatrix & | mat | ) | [inline] |
make a deep copy of the matrix
Definition at line 30 of file dssmatrix-misc.hpp.
Referenced by dssmatrix(), and operator=().
void dssmatrix::shallow_copy | ( | const _dssmatrix & | 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 dssmatrix-misc.hpp.
References data, _dssmatrix::data, line, _dssmatrix::line, _dssmatrix::n, n, and _dssmatrix::nullify().
Referenced by operator=().
dssmatrix & dssmatrix::resize | ( | const long & | _n, |
const long | _c = 0 , |
||
const long | _l = 0 |
||
) | [inline] |
resize the matrix
Definition at line 54 of file dssmatrix-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, the length of arrays, and line size 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 dssmatrix::stretch | ( | const long & | dn | ) | [inline] |
stretch the matrix size
Definition at line 79 of file dssmatrix-misc.hpp.
References data, del(), i(), line, and n.
{VERBOSE_REPORT; #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 //////// zero //////// if(dn==0){ return; } //////// non-zero //////// n +=dn; if(dn<0){ //// delete components over the new size //// for(std::vector<dcomponent>::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) ); } } }
bool dssmatrix::isListed | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
check if the component is listed
Definition at line 116 of file dssmatrix-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].i==ii && data[*p].j==jj){ return 1; } } return 0; }
long dssmatrix::number | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
return the element number of the component
Definition at line 137 of file dssmatrix-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].i==ii && data[*p].j==jj){ return *p; } } return -1; }
_drovector dssmatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 162 of file dssmatrix-misc.hpp.
References _, data, i(), line, m, n, and drovector::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 drovector vec(n); vec.zero(); for(std::vector<uint32_t>::const_iterator p=line[_m].begin(); p!=line[_m].end(); p++){ if(long(data[*p].i)==_m){ vec(data[*p].j) =data[*p].v; } else{ vec(data[*p].i) =data[*p].v; } } return _(vec); }
_dcovector dssmatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 188 of file dssmatrix-misc.hpp.
References _, data, i(), line, m, n, and dcovector::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 dcovector vec(m); vec.zero(); for(std::vector<uint32_t>::const_iterator p=line[_n].begin(); p!=line[_n].end(); p++){ if(long(data[*p].i)==_n){ vec(data[*p].j) =data[*p].v; } else{ vec(data[*p].i) =data[*p].v; } } return _(vec); }
void dssmatrix::diet | ( | const double | eps = DBL_MIN | ) | [inline] |
long dssmatrix::diag_front | ( | ) | [inline] |
reorder components so that all diagonal componets are placed in front
Definition at line 227 of file dssmatrix-misc.hpp.
References data, i(), line, and swap.
{VERBOSE_REPORT; //////// set initial dsize //////// long dsize(0); for(std::vector<dcomponent>::iterator it=data.begin(); it!=data.end(); it++){ if(it->i==it->j){ dsize++; } else{ break; } } //////// swapping loop //////// for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data.rend()-dsize; it++){ if(it->i==it->j){//is diag long c(data.rend()-it-1);//current it's index long i(data[dsize].i), j(data[dsize].j), k(it->i); //// search (k,k) line //// for(std::vector<uint32_t>::iterator p=line[k].begin(); p!=line[k].end(); p++){ if(long(data[*p].i)==k && long(data[*p].j)==k){ *p=dsize; } } //// search (i,j) line //// for(std::vector<uint32_t>::iterator p=line[i].begin(); p!=line[i].end(); p++){ if(long(*p)==dsize){ *p=c; } } //// search (j,i) line //// if(i!=j){ for(std::vector<uint32_t>::iterator p=line[j].begin(); p!=line[j].end(); p++){ if(long(*p)==dsize){ *p=c; } } } else{//i==j it--; } //// swap //// std::swap(data[dsize],data[c]); //// update //// dsize++; } } return dsize; }
void dssmatrix::reorder | ( | const bool | mode = 0 | ) | [inline] |
reorder components
Definition at line 270 of file dssmatrix-misc.hpp.
References data, ilt(), jlt(), and rebuild().
{VERBOSE_REPORT; //// sort data //// if(mode==0){ std::sort(data.begin(), data.end(), dcomponent::ilt); } else{ std::sort(data.begin(), data.end(), dcomponent::jlt); } //// rebuild line //// rebuild(); }
void dssmatrix::rebuild | ( | ) | [inline] |
void dssmatrix::checkup | ( | ) | [inline] |
health checkup
Definition at line 307 of file dssmatrix-misc.hpp.
References data, i(), line, and n.
{VERBOSE_REPORT; //////// write //////// for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ std::cerr << "array[" << it-data.begin() << "] = (" << it->i << "," << it->j << ") = " << it->v << std::endl; } std::cerr << std::endl; for(long i=0; i<n; i++){ std::cerr << "line[" << i << "] =" << std::flush; for(unsigned long k=0; k<line[i].size(); k++){ std::cerr << " " << line[i][k] << std::flush; } std::cerr << std::endl; } std::cerr << std::endl; //////// Elements //////// for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ //// m bound //// if(long(it->i)>=n){ ERROR_REPORT; std::cerr << "The indx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl << "Its i index was " << it->i << "." << std::endl; exit(1); } //// n bound //// if(long(it->j)>=n){ ERROR_REPORT; std::cerr << "The jndx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl << "Its j index was " << it->j << "." << std::endl; exit(1); } //// double-listed //// for(std::vector<dcomponent>::const_iterator IT=it+1; IT!=data.end(); IT++){ if( it->i==IT->i && it->j==IT->j ){ ERROR_REPORT; std::cerr << "The (" << it->i << ", " << it->j << ") component is double-listed at the " << it-data.begin() << "th and the" << IT-data.begin() << "the elements."<< std::endl; exit(1); } } } //////// NOTE //////// std::cerr << "# [NOTE]@dssmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl; }
dssmatrix & dssmatrix::operator= | ( | const _dssmatrix & | mat | ) | [inline] |
dssmatrix=_dssmatrix operator
Definition at line 3 of file dssmatrix-_dssmatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
dssmatrix+=dssmatrix operator
Definition at line 17 of file dssmatrix-dssmatrix.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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } return *this; }
dssmatrix & dssmatrix::operator+= | ( | const _dssmatrix & | mat | ) | [inline] |
dssmatrix+=_dssmatrix operator
Definition at line 15 of file dssmatrix-_dssmatrix.hpp.
References _dssmatrix::data, _dssmatrix::destroy(), n, and _dssmatrix::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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } mat.destroy(); return *this; }
dssmatrix-=dssmatrix operator
Definition at line 36 of file dssmatrix-dssmatrix.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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } return *this; }
dssmatrix & dssmatrix::operator-= | ( | const _dssmatrix & | mat | ) | [inline] |
dssmatrix-=_dssmatrix operator
Definition at line 36 of file dssmatrix-_dssmatrix.hpp.
References _dssmatrix::data, _dssmatrix::destroy(), n, and _dssmatrix::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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } mat.destroy(); return *this; }
dssmatrix & dssmatrix::operator*= | ( | const double & | d | ) | [inline] |
dssmatrix & dssmatrix::operator/= | ( | const double & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const dssmatrix & | mat | ||
) | [friend] |
Definition at line 210 of file dssmatrix-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 << "{" << mat.data[c].v << "}"; } } } s << std::endl; } return s; }
_dssmatrix _ | ( | dssmatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 371 of file dssmatrix-misc.hpp.
Referenced by col(), row(), to_dgematrix(), to_dgsmatrix(), to_dsymatrix(), and to_zhsmatrix().
_dssmatrix t | ( | const dssmatrix & | mat | ) | [friend] |
return transposed dssmatrix
Definition at line 3 of file dssmatrix-calc.hpp.
search the index of element having the largest absolute value in 0-based numbering system
Definition at line 21 of file dssmatrix-calc.hpp.
return its largest absolute value
Definition at line 37 of file dssmatrix-calc.hpp.
+dssmatrix operator
Definition at line 3 of file dssmatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_dssmatrix operator- | ( | const dssmatrix & | mat | ) | [friend] |
-dssmatrix operator
Definition at line 10 of file dssmatrix-unary.hpp.
_dgematrix operator+ | ( | const dssmatrix & | , |
const dgematrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dssmatrix & | , |
const _dgematrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dssmatrix & | , |
const dsymatrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dssmatrix & | , |
const _dsymatrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dssmatrix & | , |
const dgbmatrix & | |||
) | [friend] |
_dgematrix operator+ | ( | const dssmatrix & | , |
const _dgbmatrix & | |||
) | [friend] |
_dgsmatrix operator+ | ( | const dssmatrix & | , |
const dgsmatrix & | |||
) | [friend] |
_dgsmatrix operator+ | ( | const dssmatrix & | , |
const _dgsmatrix & | |||
) | [friend] |
_dssmatrix operator+ | ( | const dssmatrix & | matA, |
const dssmatrix & | matB | ||
) | [friend] |
dssmatrix+dssmatrix operator
Definition at line 59 of file dssmatrix-dssmatrix.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 dssmatrix newmat(matA); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) +=it->v; } return _(newmat); }
_dssmatrix operator+ | ( | const dssmatrix & | matA, |
const _dssmatrix & | matB | ||
) | [friend] |
dssmatrix+_dssmatrix operator
Definition at line 61 of file dssmatrix-_dssmatrix.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 dssmatrix newmat(matB); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) +=it->v; } return _(newmat); }
_dgematrix operator- | ( | const dssmatrix & | , |
const dgematrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dssmatrix & | , |
const _dgematrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dssmatrix & | , |
const dsymatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dssmatrix & | , |
const _dsymatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dssmatrix & | , |
const dgbmatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dssmatrix & | , |
const _dgbmatrix & | |||
) | [friend] |
_dgsmatrix operator- | ( | const dssmatrix & | , |
const dgsmatrix & | |||
) | [friend] |
_dgsmatrix operator- | ( | const dssmatrix & | , |
const _dgsmatrix & | |||
) | [friend] |
_dssmatrix operator- | ( | const dssmatrix & | matA, |
const dssmatrix & | matB | ||
) | [friend] |
dssmatrix-dssmatrix operator
Definition at line 79 of file dssmatrix-dssmatrix.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 dssmatrix newmat(matA); for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){ newmat(it->i,it->j) -=it->v; } return _(newmat); }
_dssmatrix operator- | ( | const dssmatrix & | matA, |
const _dssmatrix & | matB | ||
) | [friend] |
dssmatrix-_dssmatrix operator
Definition at line 83 of file dssmatrix-_dssmatrix.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 dssmatrix newmat(matB); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) -=it->v; } return _(newmat); }
_dcovector operator* | ( | const dssmatrix & | mat, |
const dcovector & | vec | ||
) | [friend] |
dssmatrix*dcovector operator
Definition at line 3 of file dssmatrix-dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.n); newvec.zero(); for(std::vector<dcomponent>::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) +=it->v*vec(it->i); } } return _(newvec); }
_dcovector operator* | ( | const dssmatrix & | mat, |
const _dcovector & | vec | ||
) | [friend] |
dssmatrix*_dcovector operator
Definition at line 3 of file dssmatrix-_dcovector.hpp.
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(mat.n!=vec.l){ ERROR_REPORT; std::cerr << "These matrix and vector can not make a product." << std::endl << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(dcovector(mat.n)); newvec.zero(); for(std::vector<dcomponent>::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) +=it->v*vec(it->i); } } vec.destroy(); return _(newvec); }
_dgematrix operator* | ( | const dssmatrix & | , |
const dgematrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dssmatrix & | , |
const _dgematrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dssmatrix & | , |
const dsymatrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dssmatrix & | , |
const _dsymatrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dssmatrix & | , |
const dgbmatrix & | |||
) | [friend] |
_dgematrix operator* | ( | const dssmatrix & | , |
const _dgbmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dssmatrix & | , |
const dgsmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dssmatrix & | , |
const _dgsmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dssmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dssmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dssmatrix operator* | ( | const dssmatrix & | mat, |
const double & | d | ||
) | [friend] |
dssmatrix*double operator
Definition at line 27 of file dssmatrix-double.hpp.
_dssmatrix operator/ | ( | const dssmatrix & | mat, |
const double & | d | ||
) | [friend] |
dssmatrix/double operator
Definition at line 38 of file dssmatrix-double.hpp.
_dssmatrix operator* | ( | const double & | d, |
const dssmatrix & | mat | ||
) | [friend] |
long const& dssmatrix::m |
matrix row size
Definition at line 9 of file dssmatrix.hpp.
Referenced by col(), operator*(), row(), to_dgematrix(), and to_dgsmatrix().
long dssmatrix::n |
matrix column size
Definition at line 10 of file dssmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), dssmatrix(), isListed(), number(), operator()(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), rebuild(), resize(), row(), shallow_copy(), stretch(), swap(), to_dgematrix(), to_dgsmatrix(), to_dsymatrix(), to_zhsmatrix(), write(), and zero().
std::vector<dcomponent> dssmatrix::data |
matrix data
Definition at line 11 of file dssmatrix.hpp.
Referenced by _(), checkup(), chsign(), clear(), col(), copy(), damax(), del(), diag_front(), diet(), dssmatrix(), idamax(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), put(), rebuild(), reorder(), resize(), row(), shallow_copy(), stretch(), swap(), to_dgematrix(), to_dgsmatrix(), to_dsymatrix(), to_zhsmatrix(), write(), zero(), and ~dssmatrix().
std::vector< std::vector<uint32_t> > dssmatrix::line |
vector of vector to store the entry information of component for each row and column
Definition at line 12 of file dssmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), diag_front(), dssmatrix(), isListed(), number(), operator()(), put(), rebuild(), resize(), row(), shallow_copy(), stretch(), swap(), zero(), and ~dssmatrix().