CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
dgsmatrix-_dcovector.hpp File Reference

Go to the source code of this file.

Functions

_dcovector operator* (const dgsmatrix &mat, const _dcovector &vec)
 

Function Documentation

_dcovector operator* ( const dgsmatrix mat,
const _dcovector vec 
)
inline

dgsmatrix*_dcovector operator

Definition at line 3 of file dgsmatrix-_dcovector.hpp.

References _(), dgsmatrix::data, _dcovector::destroy(), _dcovector::l, dgsmatrix::m, dgsmatrix::n, and dcovector::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  dcovector newvec(mat.m);
15  newvec.zero();
16 
17  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
19  newvec(it->i) += it->v * vec(it->j);
20  }
21 
22  vec.destroy();
23  return _(newvec);
24 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
void destroy() const
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9