CPPLapack
|
Real Double-precision General Sparse Matrix Class. More...
#include <dgsmatrix.hpp>
Public Member Functions | |
dgsmatrix () | |
dgsmatrix (const dgsmatrix &) | |
dgsmatrix (const _dgsmatrix &) | |
dgsmatrix (const long &, const long &, const long=0) | |
dgsmatrix (const char *) | |
~dgsmatrix () | |
_zgsmatrix | to_zgsmatrix () const |
_dgematrix | to_dgematrix () const |
double | operator() (const long &, const long &) const |
double & | operator() (const long &, const long &) |
dgsmatrix & | put (const long &, const long &, const double &) |
dgsmatrix & | del (const long, const long) |
dgsmatrix & | del (const long) |
void | write (const char *) const |
void | read (const char *) |
void | clear () |
dgsmatrix & | zero () |
void | chsign () |
void | copy (const dgsmatrix &) |
void | shallow_copy (const _dgsmatrix &) |
dgsmatrix & | resize (const long &, const long &, const long=0, const long=0) |
void | stretch (const long &, const long &) |
bool | isListed (const long &, const long &) const |
long | number (const long &, const long &) |
void | diet (const double=DBL_MIN) |
void | checkup () |
_drovector | row (const long &) const |
_dcovector | col (const long &) const |
dgsmatrix & | operator= (const dgsmatrix &) |
dgsmatrix & | operator= (const _dgsmatrix &) |
dgsmatrix & | operator+= (const dgsmatrix &) |
dgsmatrix & | operator+= (const _dgsmatrix &) |
dgsmatrix & | operator-= (const dgsmatrix &) |
dgsmatrix & | operator-= (const _dgsmatrix &) |
dgsmatrix & | operator*= (const dgsmatrix &) |
dgsmatrix & | operator*= (const _dgsmatrix &) |
dgsmatrix & | operator*= (const double &) |
dgsmatrix & | operator/= (const double &) |
Public Attributes | |
long | m |
matrix row size | |
long | n |
matrix column size | |
std::vector< dcomponent > | 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 dgsmatrix &) |
void | swap (dgsmatrix &, dgsmatrix &) |
_dgsmatrix | _ (dgsmatrix &) |
_dgsmatrix | t (const dgsmatrix &) |
void | idamax (long &, long &, const dgsmatrix &) |
double | damax (const dgsmatrix &) |
const dgsmatrix & | operator+ (const dgsmatrix &) |
_dgsmatrix | operator- (const dgsmatrix &) |
_dgematrix | operator+ (const dgsmatrix &, const dgematrix &) |
_dgematrix | operator+ (const dgsmatrix &, const _dgematrix &) |
_dgematrix | operator+ (const dgsmatrix &, const dsymatrix &) |
_dgematrix | operator+ (const dgsmatrix &, const _dsymatrix &) |
_dgematrix | operator+ (const dgsmatrix &, const dgbmatrix &) |
_dgematrix | operator+ (const dgsmatrix &, const _dgbmatrix &) |
_dgsmatrix | operator+ (const dgsmatrix &, const dgsmatrix &) |
_dgsmatrix | operator+ (const dgsmatrix &, const _dgsmatrix &) |
_dgsmatrix | operator+ (const dgsmatrix &, const dssmatrix &) |
_dgsmatrix | operator+ (const dgsmatrix &, const _dssmatrix &) |
_dgematrix | operator- (const dgsmatrix &, const dgematrix &) |
_dgematrix | operator- (const dgsmatrix &, const _dgematrix &) |
_dgematrix | operator- (const dgsmatrix &, const dsymatrix &) |
_dgematrix | operator- (const dgsmatrix &, const _dsymatrix &) |
_dgematrix | operator- (const dgsmatrix &, const dgbmatrix &) |
_dgematrix | operator- (const dgsmatrix &, const _dgbmatrix &) |
_dgsmatrix | operator- (const dgsmatrix &, const dgsmatrix &) |
_dgsmatrix | operator- (const dgsmatrix &, const _dgsmatrix &) |
_dgsmatrix | operator- (const dgsmatrix &, const dssmatrix &) |
_dgsmatrix | operator- (const dgsmatrix &, const _dssmatrix &) |
_dcovector | operator* (const dgsmatrix &, const dcovector &) |
_dcovector | operator* (const dgsmatrix &, const _dcovector &) |
_dgematrix | operator* (const dgsmatrix &, const dgematrix &) |
_dgematrix | operator* (const dgsmatrix &, const _dgematrix &) |
_dgematrix | operator* (const dgsmatrix &, const dsymatrix &) |
_dgematrix | operator* (const dgsmatrix &, const _dsymatrix &) |
_dgematrix | operator* (const dgsmatrix &, const dgbmatrix &) |
_dgematrix | operator* (const dgsmatrix &, const _dgbmatrix &) |
_dgsmatrix | operator* (const dgsmatrix &, const dgsmatrix &) |
_dgsmatrix | operator* (const dgsmatrix &, const _dgsmatrix &) |
_dgsmatrix | operator* (const dgsmatrix &, const dssmatrix &) |
_dgsmatrix | operator* (const dgsmatrix &, const _dssmatrix &) |
_dgsmatrix | operator* (const dgsmatrix &, const double &) |
_dgsmatrix | operator/ (const dgsmatrix &, const double &) |
_dgsmatrix | operator* (const double &, const dgsmatrix &) |
Real Double-precision General Sparse Matrix Class.
Definition at line 3 of file dgsmatrix.hpp.
dgsmatrix::dgsmatrix | ( | ) | [inline] |
dgsmatrix::dgsmatrix | ( | const dgsmatrix & | mat | ) | [inline] |
dgsmatrix::dgsmatrix | ( | const _dgsmatrix & | mat | ) | [inline] |
dgsmatrix constructor to cast _dgsmatrix
Definition at line 31 of file dgsmatrix-constructor.hpp.
References cols, _dgsmatrix::cols, _dgsmatrix::data, data, m, _dgsmatrix::m, _dgsmatrix::n, n, _dgsmatrix::nullify(), rows, and _dgsmatrix::rows.
dgsmatrix::dgsmatrix | ( | const long & | _m, |
const long & | _n, | ||
const long | _c = 0 |
||
) | [inline] |
dgsmatrix constructor with size specification
Definition at line 52 of file dgsmatrix-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); }
dgsmatrix::dgsmatrix | ( | const char * | filename | ) | [inline] |
dgsmatrix::~dgsmatrix | ( | ) | [inline] |
_zgsmatrix dgsmatrix::to_zgsmatrix | ( | ) | const [inline] |
cast to _zgsmatrix
Definition at line 3 of file dgsmatrix-cast.hpp.
References _, data, m, n, and zgsmatrix::put().
_dgematrix dgsmatrix::to_dgematrix | ( | ) | const [inline] |
convert to _dgematrix
Definition at line 18 of file dgsmatrix-cast.hpp.
References _, data, m, n, and dgematrix::zero().
Referenced by operator+(), and operator-().
double dgsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
operator() for const object
Definition at line 3 of file dgsmatrix-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 0.0; }
double & dgsmatrix::operator() | ( | const long & | i, |
const long & | j | ||
) | [inline] |
operator() for const object
Definition at line 25 of file dgsmatrix-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(dcomponent(i,j,0.)); return data.back().v; }
dgsmatrix & dgsmatrix::put | ( | const long & | i, |
const long & | j, | ||
const double & | v | ||
) | [inline] |
put value with volume cheack without isListed check
Definition at line 54 of file dgsmatrix-io.hpp.
References cols, data, i(), m, n, and rows.
Referenced by read(), _dssmatrix::to_dgsmatrix(), and dssmatrix::to_dgsmatrix().
{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); } for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ if( long(it->i)==i && long(it->j)==j ){ ERROR_REPORT; std::cerr << "The required component is already listed." << std::endl << "Your input was (" << i << "," << j << "," << v << ")." << std::endl; exit(1); } } #endif//CPPL_DEBUG //// push //// rows[i].push_back(data.size()); cols[j].push_back(data.size()); data.push_back(dcomponent(i,j,v)); return *this; }
dgsmatrix & dgsmatrix::del | ( | const long | i, |
const long | j | ||
) | [inline] |
delete the entry of a component
Definition at line 87 of file dgsmatrix-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]@dgsmatrix::del(long&, long&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; #endif//CPPL_DEBUG return *this; }
dgsmatrix & dgsmatrix::del | ( | const long | c | ) | [inline] |
delete the entry of an element
Definition at line 136 of file dgsmatrix-io.hpp.
References cols, data, i(), and rows.
{VERBOSE_REPORT; 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 dgsmatrix::write | ( | const char * | filename | ) | const [inline] |
Definition at line 202 of file dgsmatrix-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 << "#dgsmatrix" << " " << m << " " << 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 dgsmatrix::read | ( | const char * | filename | ) | [inline] |
Definition at line 219 of file dgsmatrix-io.hpp.
References i(), m, n, put(), and resize().
Referenced by dgsmatrix().
{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 != "dgsmatrix" && id != "#dgsmatrix" ){ ERROR_REPORT; std::cerr << "The type name of the file \"" << filename << "\" is not dgsmatrix." << std::endl << "Its type name was " << id << " ." << std::endl; exit(1); } s >> m >> n; resize(m, 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 dgsmatrix::clear | ( | ) | [inline] |
dgsmatrix & dgsmatrix::zero | ( | ) | [inline] |
change the matrix into a zero matrix
Definition at line 14 of file dgsmatrix-misc.hpp.
References cols, data, i(), m, n, and rows.
Referenced by operator*=(), _dssmatrix::to_dgsmatrix(), and dssmatrix::to_dgsmatrix().
void dgsmatrix::chsign | ( | ) | [inline] |
change sign(+/-) of the matrix
Definition at line 24 of file dgsmatrix-misc.hpp.
References data.
Referenced by operator-().
void dgsmatrix::copy | ( | const dgsmatrix & | mat | ) | [inline] |
void dgsmatrix::shallow_copy | ( | const _dgsmatrix & | 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 dgsmatrix-misc.hpp.
References cols, _dgsmatrix::cols, _dgsmatrix::data, data, m, _dgsmatrix::m, _dgsmatrix::n, n, _dgsmatrix::nullify(), rows, and _dgsmatrix::rows.
Referenced by operator=().
dgsmatrix & dgsmatrix::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 dgsmatrix-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 dgsmatrix::stretch | ( | const long & | dm, |
const long & | dn | ||
) | [inline] |
stretch the matrix size
Definition at line 93 of file dgsmatrix-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<dcomponent>::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<dcomponent>::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) ); } } }
bool dgsmatrix::isListed | ( | const long & | i, |
const long & | j | ||
) | const [inline] |
check if the component is listed
Definition at line 149 of file dgsmatrix-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>::const_iterator p=rows[i].begin(); p!=rows[i].end(); p++){ if(long(data[*p].j)==j){ return 1; } } return 0; }
long dgsmatrix::number | ( | const long & | i, |
const long & | j | ||
) | [inline] |
return the element number of the component
Definition at line 170 of file dgsmatrix-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 dgsmatrix::diet | ( | const double | eps = DBL_MIN | ) | [inline] |
void dgsmatrix::checkup | ( | ) | [inline] |
health checkup
Definition at line 249 of file dgsmatrix-misc.hpp.
References cols, data, i(), m, n, and rows.
{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<m; i++){ std::cerr << "rows[" << i << "] =" << std::flush; for(unsigned long k=0; k<rows[i].size(); k++){ std::cerr << " " << rows[i][k] << std::flush; } std::cerr << std::endl; } std::cerr << std::endl; for(long j=0; j<n; j++){ std::cerr << "cols[" << j << "] =" << std::flush; for(unsigned long k=0; k<cols[j].size(); k++){ std::cerr << " " << cols[j][k] << std::flush; } std::cerr << std::endl; } //////// Elements //////// for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){ //// m bound //// if(long(it->i)>=m){ 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 indx 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); } } } //////// ijc consistence //////// //////// NOTE //////// std::cerr << "# [NOTE]@dgsmatrix::checkup(): This sparse matrix is fine." << std::endl; }
_drovector dgsmatrix::row | ( | const long & | _m | ) | const [inline] |
get row of the matrix
Definition at line 194 of file dgsmatrix-misc.hpp.
References _, data, m, n, rows, 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=rows[_m].begin(); p!=rows[_m].end(); p++){ vec(data[*p].j) =data[*p].v; } return _(vec); }
_dcovector dgsmatrix::col | ( | const long & | _n | ) | const [inline] |
get column of the matrix
Definition at line 215 of file dgsmatrix-misc.hpp.
References _, cols, data, i(), 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=cols[_n].begin(); p!=cols[_n].end(); p++){ vec(data[*p].i) =data[*p].v; } return _(vec); }
dgsmatrix & dgsmatrix::operator= | ( | const _dgsmatrix & | mat | ) | [inline] |
dgsmatrix=_dgsmatrix operator
Definition at line 3 of file dgsmatrix-_dgsmatrix.hpp.
References shallow_copy().
{VERBOSE_REPORT; shallow_copy(mat); return *this; }
dgsmatrix+=dgsmatrix operator
Definition at line 17 of file dgsmatrix-dgsmatrix.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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) +=it->v; } return *this; }
dgsmatrix & dgsmatrix::operator+= | ( | const _dgsmatrix & | mat | ) | [inline] |
dgsmatrix+=_dgsmatrix operator
Definition at line 15 of file dgsmatrix-_dgsmatrix.hpp.
References _dgsmatrix::data, _dgsmatrix::destroy(), _dgsmatrix::m, m, n, and _dgsmatrix::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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) += it->v; } mat.destroy(); return *this; }
dgsmatrix-=dgsmatrix operator
Definition at line 36 of file dgsmatrix-dgsmatrix.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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -=it->v; } return *this; }
dgsmatrix & dgsmatrix::operator-= | ( | const _dgsmatrix & | mat | ) | [inline] |
dgsmatrix-=_dgsmatrix operator
Definition at line 35 of file dgsmatrix-_dgsmatrix.hpp.
References _dgsmatrix::data, _dgsmatrix::destroy(), _dgsmatrix::m, m, n, and _dgsmatrix::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<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){ (*this)(it->i,it->j) -= it->v; } mat.destroy(); return *this; }
dgsmatrix*=dgsmatrix operator
Definition at line 55 of file dgsmatrix-dgsmatrix.hpp.
References data, m, n, rows, swap, and zero().
{VERBOSE_REPORT; #ifdef CPPL_DEBUG if(n!=mat.m){ ERROR_REPORT; std::cerr << "These two matrises can not make a product." << std::endl << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgsmatrix newmat(m, mat.n); newmat.zero(); for(std::vector<dcomponent>::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; }
dgsmatrix & dgsmatrix::operator*= | ( | const _dgsmatrix & | mat | ) | [inline] |
dgsmatrix*=_dgsmatrix operator
Definition at line 55 of file dgsmatrix-_dgsmatrix.hpp.
References data, _dgsmatrix::data, _dgsmatrix::destroy(), _dgsmatrix::m, m, n, _dgsmatrix::n, _dgsmatrix::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 dgsmatrix newmat(m, mat.n); for(std::vector<dcomponent>::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; }
dgsmatrix & dgsmatrix::operator*= | ( | const double & | d | ) | [inline] |
dgsmatrix & dgsmatrix::operator/= | ( | const double & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const dgsmatrix & | mat | ||
) | [friend] |
Definition at line 180 of file dgsmatrix-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; }
_dgsmatrix _ | ( | dgsmatrix & | mat | ) | [friend] |
convert user object to smart-temporary object
Definition at line 326 of file dgsmatrix-misc.hpp.
Referenced by col(), row(), to_dgematrix(), and to_zgsmatrix().
_dgsmatrix t | ( | const dgsmatrix & | mat | ) | [friend] |
search the index of element having the largest absolute value in 0-based numbering system
Definition at line 21 of file dgsmatrix-calc.hpp.
return its largest absolute value
Definition at line 37 of file dgsmatrix-calc.hpp.
+dgsmatrix operator
Definition at line 3 of file dgsmatrix-unary.hpp.
{VERBOSE_REPORT;
return mat;
}
_dgsmatrix operator- | ( | const dgsmatrix & | mat | ) | [friend] |
-dgsmatrix operator
Definition at line 10 of file dgsmatrix-unary.hpp.
_dgematrix operator+ | ( | const dgsmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgsmatrix+dgematrix operator
Definition at line 3 of file dgsmatrix-dgematrix.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 dgematrix 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 dgsmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgsmatrix+_dgematrix operator
Definition at line 3 of file dgsmatrix-_dgematrix.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<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ matB(it->i,it->j) += it->v; } return matB; }
_dgematrix operator+ | ( | const dgsmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgsmatrix+dsymatrix operator
Definition at line 3 of file dgsmatrix-dsymatrix.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 dgematrix newmat( matB.to_dgematrix() ); 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 dgsmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgsmatrix+_dsymatrix operator
Definition at line 3 of file dgsmatrix-_dsymatrix.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 dgematrix newmat( matB.to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } matB.destroy(); return _(newmat); }
_dgematrix operator+ | ( | const dgsmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix+dgbmatrix operator
Definition at line 3 of file dgsmatrix-dgbmatrix.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 dgematrix newmat( matA.to_dgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } return _(newmat); }
_dgematrix operator+ | ( | const dgsmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix+_dgbmatrix operator
Definition at line 3 of file dgsmatrix-_dgbmatrix.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 dgematrix newmat( matA.to_dgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)+=matB(i,j); } } matB.destroy(); return _(newmat); }
_dgsmatrix operator+ | ( | const dgsmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix+dgsmatrix operator
Definition at line 87 of file dgsmatrix-dgsmatrix.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 dgsmatrix 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); }
_dgsmatrix operator+ | ( | const dgsmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix+_dgsmatrix operator
Definition at line 87 of file dgsmatrix-_dgsmatrix.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 dgsmatrix 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); }
_dgsmatrix operator+ | ( | const dgsmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgsmatrix operator+ | ( | const dgsmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dgematrix operator- | ( | const dgsmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgsmatrix-dgematrix operator
Definition at line 23 of file dgsmatrix-dgematrix.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 dgematrix 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 dgsmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgsmatrix-_dgematrix operator
Definition at line 22 of file dgsmatrix-_dgematrix.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.m << "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<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ matB(it->i,it->j) += it->v; } return matB; }
_dgematrix operator- | ( | const dgsmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgsmatrix-dsymatrix operator
Definition at line 24 of file dgsmatrix-dsymatrix.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 dgematrix //// dgematrix newmat( (-matB).to_dgematrix() ); //// add //// 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 dgsmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgsmatrix-_dsymatrix operator
Definition at line 24 of file dgsmatrix-_dsymatrix.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.m << "x" << matB.n << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dgematrix newmat( (-matB).to_dgematrix() ); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } matB.destroy(); return _(newmat); }
_dgematrix operator- | ( | const dgsmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix-dgbmatrix operator
Definition at line 27 of file dgsmatrix-dgbmatrix.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 dgematrix newmat( matA.to_dgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } return _(newmat); }
_dgematrix operator- | ( | const dgsmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix-_dgbmatrix operator
Definition at line 28 of file dgsmatrix-_dgbmatrix.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 dgematrix newmat( matA.to_dgematrix() ); for(long i=0; i<matB.m; i++){ for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){ newmat(i,j)-=matB(i,j); } } matB.destroy(); return _(newmat); }
_dgsmatrix operator- | ( | const dgsmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix-dgsmatrix operator
Definition at line 107 of file dgsmatrix-dgsmatrix.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 dgsmatrix 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); }
_dgsmatrix operator- | ( | const dgsmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix-_dgsmatrix operator
Definition at line 107 of file dgsmatrix-_dgsmatrix.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 dgsmatrix newmat(matB); newmat.chsign(); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ newmat(it->i,it->j) += it->v; } return _(newmat); }
_dgsmatrix operator- | ( | const dgsmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgsmatrix operator- | ( | const dgsmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dcovector operator* | ( | const dgsmatrix & | mat, |
const dcovector & | vec | ||
) | [friend] |
dgsmatrix*dcovector operator
Definition at line 3 of file dgsmatrix-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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.m); 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); } return _(newvec); }
_dcovector operator* | ( | const dgsmatrix & | mat, |
const _dcovector & | vec | ||
) | [friend] |
dgsmatrix*_dcovector operator
Definition at line 3 of file dgsmatrix-_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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; exit(1); } #endif//CPPL_DEBUG dcovector newvec(mat.m); 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); } vec.destroy(); return _(newvec); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const dgematrix & | matB | ||
) | [friend] |
dgsmatrix*dgematrix operator
Definition at line 43 of file dgsmatrix-dgematrix.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 dgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<dcomponent>::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); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const _dgematrix & | matB | ||
) | [friend] |
dgsmatrix*_dgematrix operator
Definition at line 48 of file dgsmatrix-_dgematrix.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 dgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<dcomponent>::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); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const dsymatrix & | matB | ||
) | [friend] |
dgsmatrix*dsymatrix operator
Definition at line 48 of file dgsmatrix-dsymatrix.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 dgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<dcomponent>::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); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const _dsymatrix & | matB | ||
) | [friend] |
dgsmatrix*_dsymatrix operator
Definition at line 45 of file dgsmatrix-_dsymatrix.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 dgematrix newmat(matA.m, matB.n); newmat.zero(); for(std::vector<dcomponent>::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); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix*dgbmatrix operator
Definition at line 51 of file dgsmatrix-dgbmatrix.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 dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=std::max(long(0),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); }
_dgematrix operator* | ( | const dgsmatrix & | matA, |
const _dgbmatrix & | matB | ||
) | [friend] |
dgsmatrix*_dgbmatrix operator
Definition at line 53 of file dgsmatrix-_dgbmatrix.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 dgematrix newmat( matA.m, matB.n ); newmat.zero(); for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){ for(long j=std::max(long(0),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); }
_dgsmatrix operator* | ( | const dgsmatrix & | matA, |
const dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix*dgsmatrix operator
Definition at line 127 of file dgsmatrix-dgsmatrix.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 dgsmatrix newmat( matA.m, matB.n ); for(std::vector<dcomponent>::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); }
_dgsmatrix operator* | ( | const dgsmatrix & | matA, |
const _dgsmatrix & | matB | ||
) | [friend] |
dgsmatrix*_dgsmatrix operator
Definition at line 128 of file dgsmatrix-_dgsmatrix.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 dgsmatrix newmat(matA.m, matB.n); for(std::vector<dcomponent>::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); }
_dgsmatrix operator* | ( | const dgsmatrix & | , |
const dssmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dgsmatrix & | , |
const _dssmatrix & | |||
) | [friend] |
_dgsmatrix operator* | ( | const dgsmatrix & | mat, |
const double & | d | ||
) | [friend] |
dgsmatrix*double operator
Definition at line 27 of file dgsmatrix-double.hpp.
_dgsmatrix operator/ | ( | const dgsmatrix & | mat, |
const double & | d | ||
) | [friend] |
dgsmatrix/double operator
Definition at line 38 of file dgsmatrix-double.hpp.
_dgsmatrix operator* | ( | const double & | d, |
const dgsmatrix & | mat | ||
) | [friend] |
double*dgsmatrix operator
Definition at line 3 of file double-dgsmatrix.hpp.
long dgsmatrix::m |
matrix row size
Definition at line 9 of file dgsmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), dgsmatrix(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), resize(), row(), shallow_copy(), stretch(), swap(), to_dgematrix(), to_zgsmatrix(), write(), and zero().
long dgsmatrix::n |
matrix column size
Definition at line 10 of file dgsmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), dgsmatrix(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), put(), read(), resize(), row(), shallow_copy(), stretch(), swap(), to_dgematrix(), to_zgsmatrix(), write(), and zero().
std::vector<dcomponent> dgsmatrix::data |
matrix data
Definition at line 11 of file dgsmatrix.hpp.
Referenced by _(), checkup(), chsign(), clear(), col(), copy(), damax(), del(), dgsmatrix(), diet(), idamax(), isListed(), number(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), put(), resize(), row(), shallow_copy(), stretch(), swap(), t(), to_dgematrix(), to_zgsmatrix(), write(), zero(), and ~dgsmatrix().
std::vector< std::vector<uint32_t> > dgsmatrix::rows |
array of vector to store the entry information of component for each row
Definition at line 12 of file dgsmatrix.hpp.
Referenced by _(), checkup(), clear(), copy(), del(), dgsmatrix(), isListed(), number(), operator()(), operator*(), operator*=(), operator<<(), put(), resize(), row(), shallow_copy(), stretch(), swap(), t(), zero(), and ~dgsmatrix().
std::vector< std::vector<uint32_t> > dgsmatrix::cols |
array of vector to store the entry information of component for each column
Definition at line 13 of file dgsmatrix.hpp.
Referenced by _(), checkup(), clear(), col(), copy(), del(), dgsmatrix(), operator()(), put(), resize(), shallow_copy(), stretch(), swap(), t(), zero(), and ~dgsmatrix().