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