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

Go to the source code of this file.

Functions

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

Function Documentation

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

dsymatrix+dgsmatrix operator

Definition at line 3 of file dsymatrix-dgsmatrix.hpp.

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  return _(newmat);
}
_dgematrix operator- ( const dsymatrix matA,
const dgsmatrix matB 
) [inline]

dsymatrix-dgsmatrix operator

Definition at line 24 of file dsymatrix-dgsmatrix.hpp.

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) -= it->v;
  }
  
  return _(newmat);
}
_dgematrix operator* ( const dsymatrix matA,
const dgsmatrix matB 
) [inline]

dsymatrix*dgsmatrix operator

Definition at line 45 of file dsymatrix-dgsmatrix.hpp.

References _(), dgsmatrix::data, i(), _dgematrix::i, dgsmatrix::m, dsymatrix::n, dgsmatrix::n, and dgematrix::zero().

{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.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat(matA.n, matB.n);
  newmat.zero();
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    for(long i=0; i<matA.n; i++){
      newmat(i,it->j) += matB(i,it->i)*it->v;
    }
  }
  
  return _(newmat);
}
 All Classes Files Functions Variables Friends