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

Go to the source code of this file.

Functions

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

Function Documentation

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

zgematrix+zgsmatrix operator

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

References _(), zgsmatrix::data, zcomponent::i, zcomponent::j, zgematrix::m, zgsmatrix::m, zgsmatrix::n, zgematrix::n, and zcomponent::v.

{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(size_t c=0; c<matB.data.size(); c++){
    const zcomponent& z =matB.data[c];
    newmat(z.i,z.j) += z.v;
  }
  
  return _(newmat);
}
_zgematrix operator- ( const zgematrix matA,
const zgsmatrix matB 
) [inline]

zgematrix-zgsmatrix operator

Definition at line 25 of file zgematrix-zgsmatrix.hpp.

References _(), zgsmatrix::data, zcomponent::i, zcomponent::j, zgematrix::m, zgsmatrix::m, zgsmatrix::n, zgematrix::n, and zcomponent::v.

{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(size_t c=0; c<matB.data.size(); c++){
    const zcomponent& z =matB.data[c];
    newmat(z.i,z.j) -= z.v;
  }
  
  return _(newmat);
}
_zgematrix operator* ( const zgematrix matA,
const zgsmatrix matB 
) [inline]

zgematrix*zgsmatrix operator

Definition at line 47 of file zgematrix-zgsmatrix.hpp.

References _(), zgsmatrix::data, zcomponent::i, i(), zcomponent::j, zgsmatrix::m, zgematrix::m, zgsmatrix::n, zgematrix::n, zcomponent::v, 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(size_t c=0; c<matB.data.size(); c++){
    const zcomponent& z =matB.data[c];
    for(long i=0; i<matA.m; i++){
      newmat(i,z.j) += matA(i,z.i)*z.v;
    }
  }
  
  return _(newmat);
}
 All Classes Files Functions Variables Friends