CPPLapack
 All Classes Files Functions Variables Friends
Functions
zrovector-_zgsmatrix.hpp File Reference

Go to the source code of this file.

Functions

_zrovector operator* (const zrovector &vec, const _zgsmatrix &mat)

Function Documentation

_zrovector operator* ( const zrovector vec,
const _zgsmatrix mat 
) [inline]

zrovector*_zgsmatrix operator

Definition at line 3 of file zrovector-_zgsmatrix.hpp.

References _(), _zgsmatrix::data, _zgsmatrix::destroy(), zrovector::l, _zgsmatrix::m, _zgsmatrix::n, and zrovector::zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zrovector newvec(mat.n);
  newvec.zero();
  
  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
  }
  
  mat.destroy();
  return _(newvec);
}
 All Classes Files Functions Variables Friends