CPPLapack
 All Classes Files Functions Variables Friends
Functions
dssmatrix-_dssmatrix.hpp File Reference

Go to the source code of this file.

Functions

_dssmatrix operator+ (const dssmatrix &matA, const _dssmatrix &matB)
_dssmatrix operator- (const dssmatrix &matA, const _dssmatrix &matB)

Function Documentation

_dssmatrix operator+ ( const dssmatrix matA,
const _dssmatrix matB 
) [inline]

dssmatrix+_dssmatrix operator

Definition at line 61 of file dssmatrix-_dssmatrix.hpp.

References _(), dssmatrix::data, dssmatrix::n, and _dssmatrix::n.

{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);
}
_dssmatrix operator- ( const dssmatrix matA,
const _dssmatrix matB 
) [inline]

dssmatrix-_dssmatrix operator

Definition at line 83 of file dssmatrix-_dssmatrix.hpp.

References _(), dssmatrix::data, dssmatrix::n, and _dssmatrix::n.

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