CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
_dgematrix-dssmatrix.hpp File Reference

Go to the source code of this file.

Functions

_dgematrix operator* (const _dgematrix &matA, const dssmatrix &matB)
 

Function Documentation

_dgematrix operator* ( const _dgematrix matA,
const dssmatrix matB 
)
inline

_dgematrix*dssmatrix operator

Definition at line 3 of file _dgematrix-dssmatrix.hpp.

References _(), dssmatrix::data, _dgematrix::destroy(), i(), _dgematrix::i, dssmatrix::m, _dgematrix::m, _dgematrix::n, dssmatrix::n, and dgematrix::zero().

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 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
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
void destroy() const
CPPL_INT n
matrix column size
Definition: dssmatrix.hpp:10
CPPL_INT const & m
matrix row size
Definition: dssmatrix.hpp:9
_dcovector _(dcovector &vec)