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

Go to the source code of this file.

Functions

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

Function Documentation

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

zrovector*_zhsmatrix operator

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

References _(), conj(), _zhsmatrix::data, _zhsmatrix::destroy(), zrovector::l, _zhsmatrix::m, _zhsmatrix::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;
    if(it->i!=it->j){
      newvec(it->i) +=vec(it->j)*std::conj(it->v);
    }
  }
  
  mat.destroy();
  return _(newvec);
}
 All Classes Files Functions Variables Friends