CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
_zgematrix-zssmatrix.hpp File Reference

Go to the source code of this file.

Functions

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

Function Documentation

_zgematrix operator+ ( const _zgematrix matA,
const zhematrix matB 
)
inline

_zgematrix+zhematrix operator

Definition at line 3 of file _zgematrix-zssmatrix.hpp.

References zhematrix::array, _zgematrix::m, zhematrix::m, _zgematrix::n, and zhematrix::n.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=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.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  for(CPPL_INT c=0; c<matB.vol; c++){
15  matA(matB.indx[c],matB.jndx[c]) += matB.array[c];
16  }
17 
18  return matA;
19 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator- ( const _zgematrix matA,
const zhematrix matB 
)
inline

_zgematrix-zhematrix operator

Definition at line 23 of file _zgematrix-zssmatrix.hpp.

References _zgematrix::array, zhematrix::array, i(), _zgematrix::m, zhematrix::m, _zgematrix::n, and zhematrix::n.

24 {CPPL_VERBOSE_REPORT;
25 #ifdef CPPL_DEBUG
26  if(matA.m!=matB.m || matA.n!=matB.n){
27  ERROR_REPORT;
28  std::cerr << "These two matrises can not make a subtraction." << std::endl
29  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
30  exit(1);
31  }
32 #endif//CPPL_DEBUG
33 
34  //// change sign ////
35  for(CPPL_INT i=0; i<matA.m*matA.n; i++){
36  matA.array[i]=-matA.array[i];
37  }
38 
39  //// add ////
40  for(CPPL_INT c=0; c<matB.vol; c++){
41  matA(matB.indx[c],matB.jndx[c]) += matB.array[c];
42  }
43 
44  return matA;
45 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator* ( const _zgematrix matA,
const zhematrix matB 
)
inline

_zgematrix*zhematrix operator

Definition at line 49 of file _zgematrix-zssmatrix.hpp.

References _(), zhematrix::array, _zgematrix::destroy(), i(), _zgematrix::m, zhematrix::m, _zgematrix::n, zhematrix::n, and zgematrix::zero().

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