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

zgematrix-zgsmatrix operator

Definition at line 27 of file zgematrix-zgsmatrix.hpp.

References _(), zgsmatrix::data, 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  return _(newmat);
47 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
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 i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgematrix operator* ( const zgematrix matA,
const zgsmatrix matB 
)
inline

zgematrix*zgsmatrix operator

Definition at line 51 of file zgematrix-zgsmatrix.hpp.

References _(), zgsmatrix::data, zcomponent::i, i(), zcomponent::j, zgsmatrix::m, zgematrix::m, zgsmatrix::n, zgematrix::n, zcomponent::v, 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.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  zgematrix newmat(matA.m, matB.n);
63  newmat.zero();
64 
65  const size_t matB_data_size =matB.data.size();
66  for(size_t c=0; c<matB_data_size; c++){
67  const zcomponent& z =matB.data[c];
68  for(CPPL_INT i=0; i<matA.m; i++){
69  newmat(i,z.j) += matA(i,z.i)*z.v;
70  }
71  }
72 
73  return _(newmat);
74 }
comple v
value of the component
Definition: zcomponent.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
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 i
i index of the component
Definition: zcomponent.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)