CPPLapack
 All Classes Files Functions Variables Friends
Functions
dgsmatrix-_dgsmatrix.hpp File Reference

Go to the source code of this file.

Functions

_dgsmatrix operator+ (const dgsmatrix &matA, const _dgsmatrix &matB)
_dgsmatrix operator- (const dgsmatrix &matA, const _dgsmatrix &matB)
_dgsmatrix operator* (const dgsmatrix &matA, const _dgsmatrix &matB)

Function Documentation

_dgsmatrix operator+ ( const dgsmatrix matA,
const _dgsmatrix matB 
) [inline]

dgsmatrix+_dgsmatrix operator

Definition at line 87 of file dgsmatrix-_dgsmatrix.hpp.

References _(), dgsmatrix::data, _dgsmatrix::m, dgsmatrix::m, dgsmatrix::n, and _dgsmatrix::n.

{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 matA,
const _dgsmatrix matB 
) [inline]

dgsmatrix-_dgsmatrix operator

Definition at line 107 of file dgsmatrix-_dgsmatrix.hpp.

References _(), dgsmatrix::chsign(), dgsmatrix::data, _dgsmatrix::m, dgsmatrix::m, dgsmatrix::n, and _dgsmatrix::n.

{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 matA,
const _dgsmatrix matB 
) [inline]

dgsmatrix*_dgsmatrix operator

Definition at line 128 of file dgsmatrix-_dgsmatrix.hpp.

References _(), dgsmatrix::data, _dgsmatrix::data, _dgsmatrix::destroy(), _dgsmatrix::m, dgsmatrix::m, _dgsmatrix::n, dgsmatrix::n, and _dgsmatrix::rows.

{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);
}
 All Classes Files Functions Variables Friends