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 59 of file dssmatrix-dssmatrix.hpp.

References _(), dssmatrix::data, 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(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 
) [inline]

dssmatrix-dssmatrix operator

Definition at line 79 of file dssmatrix-dssmatrix.hpp.

References _(), dssmatrix::data, 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(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);
}
 All Classes Files Functions Variables Friends