CPPLapack
 All Classes Files Functions Variables Friends Pages
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().

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  }
21 
22  mat.destroy();
23  return _(newvec);
24 }
CPPL_INT l
vector size
Definition: zrovector.hpp:9
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision Row Vector Class.
Definition: zrovector.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11