CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
_zgsmatrix-_zhematrix.hpp File Reference

Go to the source code of this file.

Functions

_zgematrix operator+ (const _zgsmatrix &matA, const _zhematrix &matB)
 
_zgematrix operator- (const _zgsmatrix &matA, const _zhematrix &matB)
 
_zgematrix operator* (const _zgsmatrix &matA, const _zhematrix &matB)
 

Function Documentation

_zgematrix operator+ ( const _zgsmatrix matA,
const _zhematrix matB 
)
inline

_zgsmatrix+_zhematrix operator

Definition at line 3 of file _zgsmatrix-_zhematrix.hpp.

References _(), _zgsmatrix::data, _zhematrix::destroy(), _zgsmatrix::destroy(), _zgsmatrix::m, _zgsmatrix::n, _zhematrix::n, and _zhematrix::to_zgematrix().

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.n || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat( matB.to_zgematrix() );
15 
16  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  matA.destroy();
22  matB.destroy();
23  return _(newmat);
24 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
void destroy() const
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgsmatrix matA,
const _zhematrix matB 
)
inline

_zgsmatrix-_zhematrix operator

Definition at line 28 of file _zgsmatrix-_zhematrix.hpp.

References _(), _zgsmatrix::data, _zgsmatrix::destroy(), _zhematrix::destroy(), _zgsmatrix::m, _zgsmatrix::n, and _zhematrix::n.

29 {CPPL_VERBOSE_REPORT;
30 #ifdef CPPL_DEBUG
31  if(matA.m!=matB.n || matA.n!=matB.n){
32  ERROR_REPORT;
33  std::cerr << "These two matrises can not make a subtraction." << std::endl
34  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
35  exit(1);
36  }
37 #endif//CPPL_DEBUG
38 
39  //// shallow copy to zgematrix ////
40  zgematrix newmat( (-matB).to_zgematrix() );
41 
42  //// add ////
43  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
44  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
45  newmat(it->i,it->j) += it->v;
46  }
47 
48  ////////
49  matA.destroy();
50  matB.destroy();
51  return _(newmat);
52 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const _zgsmatrix matA,
const _zhematrix matB 
)
inline

_zgsmatrix*_zhematrix operator

Definition at line 56 of file _zgsmatrix-_zhematrix.hpp.

References _(), _zgsmatrix::data, _zhematrix::destroy(), _zgsmatrix::destroy(), i(), _zgsmatrix::m, _zgsmatrix::n, _zhematrix::n, and zgematrix::zero().

57 {CPPL_VERBOSE_REPORT;
58 #ifdef CPPL_DEBUG
59  if(matA.n!=matB.n){
60  ERROR_REPORT;
61  std::cerr << "These two matrises can not make a product." << std::endl
62  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
63  exit(1);
64  }
65 #endif//CPPL_DEBUG
66 
67  zgematrix newmat(matA.m, matB.n);
68  newmat.zero();
69 
70  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
71  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
72  for(CPPL_INT i=0; i<matB.n; i++){
73  newmat(it->i,i) += it->v*matB(it->j,i);
74  }
75  }
76 
77  matA.destroy();
78  matB.destroy();
79  return _(newmat);
80 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11