CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
zhsmatrix-_zhsmatrix.hpp File Reference

Go to the source code of this file.

Functions

_zhsmatrix operator+ (const zhsmatrix &matA, const _zhsmatrix &matB)
 
_zhsmatrix operator- (const zhsmatrix &matA, const _zhsmatrix &matB)
 

Function Documentation

_zhsmatrix operator+ ( const zhsmatrix matA,
const _zhsmatrix matB 
)
inline

zhsmatrix+_zhsmatrix operator

Definition at line 63 of file zhsmatrix-_zhsmatrix.hpp.

References _(), zhsmatrix::data, zhsmatrix::n, and _zhsmatrix::n.

64 {CPPL_VERBOSE_REPORT;
65 #ifdef CPPL_DEBUG
66  if(matA.n!=matB.n){
67  ERROR_REPORT;
68  std::cerr << "These two matrises can not make a summation." << std::endl
69  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
70  exit(1);
71  }
72 #endif//CPPL_DEBUG
73 
74  zhsmatrix newmat(matB);
75 
76  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
77  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
78  newmat(it->i,it->j) +=it->v;
79  }
80 
81  return _(newmat);
82 }
CPPL_INT n
matrix column size
Definition: zhsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< zcomponent > data
matrix data
Definition: zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
_zhsmatrix operator- ( const zhsmatrix matA,
const _zhsmatrix matB 
)
inline

zhsmatrix-_zhsmatrix operator

Definition at line 86 of file zhsmatrix-_zhsmatrix.hpp.

References _(), zhsmatrix::data, zhsmatrix::n, and _zhsmatrix::n.

87 {CPPL_VERBOSE_REPORT;
88 #ifdef CPPL_DEBUG
89  if(matA.n!=matB.n){
90  ERROR_REPORT;
91  std::cerr << "These two matrises can not make a subtraction." << std::endl
92  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
93  exit(1);
94  }
95 #endif//CPPL_DEBUG
96 
97  zhsmatrix newmat(-matB);
98 
99  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
100  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
101  newmat(it->i,it->j) +=it->v;
102  }
103 
104  return _(newmat);
105 }
CPPL_INT n
matrix column size
Definition: zhsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< zcomponent > data
matrix data
Definition: zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)