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 3 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(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 25 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(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