CPPLapack
 All Classes Files Functions Variables Friends
Functions
zgematrix-zssmatrix.hpp File Reference

Go to the source code of this file.

Functions

_zgematrix operator+ (const zgematrix &matA, const zhematrix &matB)
_zgematrix operator- (const zgematrix &matA, const zhematrix &matB)
_zgematrix operator* (const zgematrix &matA, const zhematrix &matB)

Function Documentation

_zgematrix operator+ ( const zgematrix matA,
const zhematrix matB 
) [inline]

zgematrix+zhematrix operator

Definition at line 3 of file zgematrix-zssmatrix.hpp.

References _(), zhematrix::array, zgematrix::m, zhematrix::m, zgematrix::n, and zhematrix::n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA);
  for(long c=0; c<matB.vol; c++){
    newmat(matB.indx[c],matB.jndx[c]) += matB.array[c];
  }
  
  return _(newmat);
}
_zgematrix operator- ( const zgematrix matA,
const zhematrix matB 
) [inline]

zgematrix-zhematrix operator

Definition at line 24 of file zgematrix-zssmatrix.hpp.

References _(), zhematrix::array, zgematrix::m, zhematrix::m, zgematrix::n, and zhematrix::n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  zgematrix newmat(matA);
  for(long c=0; c<matB.vol; c++){
    newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c];
  }
  
  return _(newmat);
}
_zgematrix operator* ( const zgematrix matA,
const zhematrix matB 
) [inline]

zgematrix*zhematrix operator

Definition at line 45 of file zgematrix-zssmatrix.hpp.

References _(), zhematrix::array, i(), zgematrix::m, zhematrix::m, zgematrix::n, zhematrix::n, and zgematrix::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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(long c=0; c<matB.vol; c++){
    for(long i=0; i<matA.m; i++){
      newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c];
    }
  }
  
  return _(newmat);
}
 All Classes Files Functions Variables Friends