CPPLapack
 All Classes Files Functions Variables Friends Pages
_dgematrix-dssmatrix.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! _dgematrix*dssmatrix operator */
3 inline _dgematrix operator*(const _dgematrix& matA, const dssmatrix& matB)
4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a product." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat(matA.m, matB.n);
15  newmat.zero();
16 
17  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
18  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
19  for(CPPL_INT i=0; i<matA.m; i++){
20  newmat(i,it->j) +=matA(i,it->i)*it->v;
21  }
22  if(it->i!=it->j){
23  for(CPPL_INT i=0; i<matA.m; i++){
24  newmat(i,it->i) +=matA(i,it->j)*it->v;
25  }
26  }
27  }
28 
29  matA.destroy();
30  return _(newmat);
31 }
std::vector< dcomponent > data
matrix data
Definition: dssmatrix.hpp:11
dgematrix & zero()
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
friend _dgematrix i(const _dgematrix &)
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
_dgematrix operator*(const _dgematrix &matA, const dssmatrix &matB)
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
void destroy() const
Real Double-precision Symmetric Sparse Matrix Class.
Definition: dssmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: dssmatrix.hpp:10
CPPL_INT const & m
matrix row size
Definition: dssmatrix.hpp:9
_dcovector _(dcovector &vec)