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

Go to the source code of this file.

Functions

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

Function Documentation

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

_zgematrix+_zgsmatrix operator

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

References _zgsmatrix::data, _zgsmatrix::destroy(), zcomponent::i, zcomponent::j, _zgematrix::m, _zgsmatrix::m, _zgsmatrix::n, _zgematrix::n, and zcomponent::v.

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  const size_t matB_data_size =matB.data.size();
15  for(size_t c=0; c<matB_data_size; c++){
16  const zcomponent& z =matB.data[c];
17  matA(z.i,z.j) += z.v;
18  }
19 
20  matB.destroy();
21  return matA;
22 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgematrix matA,
const _zgsmatrix matB 
)
inline

_zgematrix-_zgsmatrix operator

Definition at line 26 of file _zgematrix-_zgsmatrix.hpp.

References _zgsmatrix::data, _zgsmatrix::destroy(), zcomponent::i, zcomponent::j, _zgematrix::m, _zgsmatrix::m, _zgsmatrix::n, _zgematrix::n, and zcomponent::v.

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(matA.m!=matB.m || matA.n!=matB.n){
30  ERROR_REPORT;
31  std::cerr << "These two matrises can not make a subtraction." << std::endl
32  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  const size_t matB_data_size =matB.data.size();
38  for(size_t c=0; c<matB_data_size; c++){
39  const zcomponent& z =matB.data[c];
40  matA(z.i,z.j) -= z.v;
41  }
42 
43  matB.destroy();
44  return matA;
45 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const _zgematrix matA,
const _zgsmatrix matB 
)
inline

_zgematrix*_zgsmatrix operator

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

References _(), _zgsmatrix::data, _zgematrix::destroy(), _zgsmatrix::destroy(), zcomponent::i, i(), zcomponent::j, _zgematrix::m, _zgsmatrix::m, _zgematrix::n, _zgsmatrix::n, zcomponent::v, 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  const size_t matB_data_size =matB.data.size();
64  for(size_t c=0; c<matB_data_size; c++){
65  const zcomponent& z =matB.data[c];
66  for(CPPL_INT i=0; i<matA.m; i++){
67  newmat(i,z.j) += matA(i,z.i)*z.v;
68  }
69  }
70 
71  matA.destroy();
72  matB.destroy();
73  return _(newmat);
74 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_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
Component Class for Complex Double-precision Sparse Matrix Classes.
Definition: zcomponent.hpp:3
CPPL_INT j
j index of the component
Definition: zcomponent.hpp:10
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.hpp:9
_dcovector _(dcovector &vec)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11