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  zgematrix newmat(matA);
15  const size_t matB_data_size =matB.data.size();
16  for(size_t c=0; c<matB_data_size; c++){
17  const zcomponent& z =matB.data[c];
18  newmat(z.i,z.j) += z.v;
19  }
20 
21  matB.destroy();
22  return _(newmat);
23 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.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
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 m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
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 27 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.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.m!=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.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zgematrix newmat(matA);
39 
40  const size_t matB_data_size =matB.data.size();
41  for(size_t c=0; c<matB_data_size; c++){
42  const zcomponent& z =matB.data[c];
43  newmat(z.i,z.j) -= z.v;
44  }
45 
46  matB.destroy();
47  return _(newmat);
48 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.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
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 m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
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 52 of file zgematrix-_zgsmatrix.hpp.

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

53 {CPPL_VERBOSE_REPORT;
54 #ifdef CPPL_DEBUG
55  if(matA.n!=matB.m){
56  ERROR_REPORT;
57  std::cerr << "These two matrises can not make a product." << std::endl
58  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
59  exit(1);
60  }
61 #endif//CPPL_DEBUG
62 
63  zgematrix newmat(matA.m, matB.n);
64  newmat.zero();
65 
66  const size_t matB_data_size =matB.data.size();
67  for(size_t c=0; c<matB_data_size; c++){
68  const zcomponent& z =matB.data[c];
69  for(CPPL_INT i=0; i<matA.m; i++){
70  newmat(i,z.j) += matA(i,z.i)*z.v;
71  }
72  }
73 
74  matB.destroy();
75  return _(newmat);
76 }
comple v
value of the component
Definition: zcomponent.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.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
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 m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11