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  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  return matA;
21 }
comple v
value of the component
Definition: zcomponent.hpp:11
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
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: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator- ( const _zgematrix matA,
const zgsmatrix matB 
)
inline

_zgematrix-zgsmatrix operator

Definition at line 25 of file _zgematrix-zgsmatrix.hpp.

References zgsmatrix::data, zcomponent::i, zcomponent::j, _zgematrix::m, zgsmatrix::m, zgsmatrix::n, _zgematrix::n, and zcomponent::v.

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

_zgematrix*zgsmatrix operator

Definition at line 47 of file _zgematrix-zgsmatrix.hpp.

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

48 {CPPL_VERBOSE_REPORT;
49 #ifdef CPPL_DEBUG
50  if(matA.n!=matB.m){
51  ERROR_REPORT;
52  std::cerr << "These two matrises can not make a product." << std::endl
53  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
54  exit(1);
55  }
56 #endif//CPPL_DEBUG
57 
58  zgematrix newmat(matA.m, matB.n);
59  newmat.zero();
60 
61  const size_t matB_data_size =matB.data.size();
62  for(size_t c=0; c<matB_data_size; c++){
63  const zcomponent& z =matB.data[c];
64  for(CPPL_INT i=0; i<matA.m; i++){
65  newmat(i,z.j) += matA(i,z.i)*z.v;
66  }
67  }
68 
69  matA.destroy();
70  return _(newmat);
71 }
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)
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
void destroy() const
CPPL_INT i
i index of the component
Definition: zcomponent.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)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10