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

Go to the source code of this file.

Functions

_dssmatrix operator+ (const dssmatrix &matA, const dssmatrix &matB)
 
_dssmatrix operator- (const dssmatrix &matA, const dssmatrix &matB)
 

Function Documentation

_dssmatrix operator+ ( const dssmatrix matA,
const dssmatrix matB 
)
inline

dssmatrix+dssmatrix operator

Definition at line 63 of file dssmatrix-dssmatrix.hpp.

References _(), dssmatrix::data, and dssmatrix::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  dssmatrix newmat(matA);
75 
76  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
77  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
78  newmat(it->i,it->j) +=it->v;
79  }
80 
81  return _(newmat);
82 }
std::vector< dcomponent > data
matrix data
Definition: dssmatrix.hpp:11
Real Double-precision Symmetric Sparse Matrix Class.
Definition: dssmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: dssmatrix.hpp:10
_dcovector _(dcovector &vec)
_dssmatrix operator- ( const dssmatrix matA,
const dssmatrix matB 
)
inline

dssmatrix-dssmatrix operator

Definition at line 86 of file dssmatrix-dssmatrix.hpp.

References _(), dssmatrix::data, and dssmatrix::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  dssmatrix newmat(matA);
98 
99  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
100  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
101  newmat(it->i,it->j) -=it->v;
102  }
103 
104  return _(newmat);
105 }
std::vector< dcomponent > data
matrix data
Definition: dssmatrix.hpp:11
Real Double-precision Symmetric Sparse Matrix Class.
Definition: dssmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: dssmatrix.hpp:10
_dcovector _(dcovector &vec)