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

Go to the source code of this file.

Functions

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

Function Documentation

_zgematrix operator+ ( const _zhematrix matA,
const _zssmatrix &  matB 
)
inline

_zhematrix+_zssmatrix operator

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

References _(), zgematrix::array, _zhematrix::destroy(), and _zhematrix::n.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.m || 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.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat =matA;
15 
16  for(CPPL_INT c=0; c<matB.vol; c++){
17  newmat(matB.indx[c],matB.jndx[c]) += matB.array[c];
18  }
19 
20  matA.destroy();
21  matB.destroy();
22  return _(newmat);
23 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void destroy() const
_dcovector _(dcovector &vec)
_zgematrix operator- ( const _zhematrix matA,
const _zssmatrix &  matB 
)
inline

_zhematrix-_zssmatrix operator

Definition at line 27 of file _zhematrix-_zssmatrix.hpp.

References _(), zgematrix::array, _zhematrix::destroy(), and _zhematrix::n.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.n!=matB.m || matA.n!=matB.n){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zgematrix newmat =matA;
39 
40  for(CPPL_INT c=0; c<matB.vol; c++){
41  newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c];
42  }
43 
44  matA.destroy();
45  matB.destroy();
46  return _(newmat);
47 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
void destroy() const
_dcovector _(dcovector &vec)
_zgematrix operator* ( const _zhematrix matA,
const _zssmatrix &  matB 
)
inline

_zhematrix*_zssmatrix operator

Definition at line 51 of file _zhematrix-_zssmatrix.hpp.

References _(), _zhematrix::array, _zhematrix::destroy(), i(), _zhematrix::n, and zgematrix::zero().

52 {CPPL_VERBOSE_REPORT;
53 #ifdef CPPL_DEBUG
54  if(matA.n!=matB.m){
55  ERROR_REPORT;
56  std::cerr << "These two matrises can not make a product." << std::endl
57  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  zgematrix newmat(matA.n, matB.n);
63  newmat.zero();
64 
65  for(CPPL_INT c=0; c<matB.vol; c++){
66  for(CPPL_INT i=0; i<matA.n; i++){
67  newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c];
68  }
69  }
70 
71  matA.destroy();
72  matB.destroy();
73  return _(newmat);
74 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
void destroy() const
_dcovector _(dcovector &vec)