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