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

Go to the source code of this file.

Functions

_zcovector operator* (const _zgsmatrix &mat, const _zcovector &vec)
 

Function Documentation

_zcovector operator* ( const _zgsmatrix mat,
const _zcovector vec 
)
inline

_zgsmatrix*_zcovector operator

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

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

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.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.m);
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  }
21 
22  mat.destroy();
23  vec.destroy();
24  return _(newvec);
25 }
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11