CPPLapack
 All Classes Files Functions Variables Friends
Functions
zhsmatrix-_zhsmatrix.hpp File Reference

Go to the source code of this file.

Functions

_zhsmatrix operator+ (const zhsmatrix &matA, const _zhsmatrix &matB)
_zhsmatrix operator- (const zhsmatrix &matA, const _zhsmatrix &matB)

Function Documentation

_zhsmatrix operator+ ( const zhsmatrix matA,
const _zhsmatrix matB 
) [inline]

zhsmatrix+_zhsmatrix operator

Definition at line 61 of file zhsmatrix-_zhsmatrix.hpp.

References _(), zhsmatrix::data, zhsmatrix::n, and _zhsmatrix::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

  zhsmatrix newmat(matB);
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) +=it->v;
  }
  
  return _(newmat);
}
_zhsmatrix operator- ( const zhsmatrix matA,
const _zhsmatrix matB 
) [inline]

zhsmatrix-_zhsmatrix operator

Definition at line 83 of file zhsmatrix-_zhsmatrix.hpp.

References _(), zhsmatrix::data, zhsmatrix::n, and _zhsmatrix::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
  
  zhsmatrix newmat(-matB);
  
  for(std::vector<zcomponent>::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