My Project
_zssmatrix-zcovector.hpp
1 //=============================================================================
3 inline _zcovector operator*(const _zssmatrix& mat, const zcovector& vec)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] operator*(const _zssmatrix&, const zcovector&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10 #ifdef CPPL_DEBUG
11  if(mat.N!=vec.L){
12  std::cerr << "[ERROR] operator*(const _zssmatrix&, const zcovector&)"
13  << std::endl
14  << "These matrix and vector can not make a product." << std::endl
15  << "Your input was (" << mat.M << "x" << mat.N << ") * ("
16  << vec.L << ")." << std::endl;
17  exit(1);
18  }
19 #endif//CPPL_DEBUG
20 
21  zcovector newvec(mat.M);
22  newvec.zero();
23 
24  for(int c=0; c<mat.VOL; c++){
25  newvec(mat.Indx[c]) +=mat.Array[c]*vec(mat.Jndx[c]);
26  }
27 
28  mat.destroy();
29  return _(newvec);
30 }
friend _zrovector _(zrovector &)
Definition: zrovector-misc.hpp:131
long M
matrix row size
Definition: _zssmatrix.hpp:7
long VOL
the number of non-zero components
Definition: _zssmatrix.hpp:10
(DO NOT USE) Smart-temporary Complex Double-precision Sparse Matrix Class
Definition: _zssmatrix.hpp:3
void zero()
Definition: zcovector-misc.hpp:23
std::complex< double > * Array
1D array to store non-zero matrix data
Definition: _zssmatrix.hpp:11
void destroy() const
Definition: _zssmatrix-misc.hpp:3
friend _zrovector operator*(const zrovector &, const zgematrix &)
Definition: zrovector-zgematrix.hpp:3
long N
matrix column size
Definition: _zssmatrix.hpp:8
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
long * Jndx
1D array to store the j-index of non-zero matrix components
Definition: _zssmatrix.hpp:13
long * Indx
1D array to store the i-index of non-zero matrix components
Definition: _zssmatrix.hpp:12