CPPLapack
 All Classes Files Functions Variables Friends Pages
_zrovector-_zhsmatrix.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! _zrovector*_zhsmatrix operator */
3 inline _zrovector operator*(const _zrovector& vec, const _zhsmatrix& mat)
4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(vec.l!=mat.m){
7  ERROR_REPORT;
8  std::cerr << "These vector and matrix can not make a product." << std::endl
9  << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zrovector newvec(mat.n);
15  newvec.zero();
16 
17  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
19  newvec(it->j) +=vec(it->i)*it->v;
20  if(it->i!=it->j){
21  newvec(it->i) +=vec(it->j)*std::conj(it->v);
22  }
23  }
24 
25  vec.destroy();
26  mat.destroy();
27  return _(newvec);
28 }
_zrovector operator*(const _zrovector &vec, const _zhsmatrix &mat)
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
CPPL_INT const & m
matrix row size
Definition: _zhsmatrix.hpp:10
void destroy() const
void destroy() const
_zcovector conj(const _zcovector &vec)
CPPL_INT l
vector size
Definition: _zrovector.hpp:9
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
Complex Double-precision Row Vector Class.
Definition: zrovector.hpp:3
(DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class
Definition: _zrovector.hpp:3
_dcovector _(dcovector &vec)
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class ...
Definition: _zhsmatrix.hpp:3
zrovector & zero()