CPPLapack
 All Classes Files Functions Variables Friends Pages
zgematrix-zssmatrix.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! zgematrix+zhematrix operator */
3 inline _zgematrix operator+(const zgematrix& matA, const zhematrix& matB)
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  for(CPPL_INT c=0; c<matB.vol; c++){
16  newmat(matB.indx[c],matB.jndx[c]) += matB.array[c];
17  }
18 
19  return _(newmat);
20 }
21 
22 //=============================================================================
23 /*! zgematrix-zhematrix operator */
24 inline _zgematrix operator-(const zgematrix& matA, const zhematrix& matB)
25 {CPPL_VERBOSE_REPORT;
26 #ifdef CPPL_DEBUG
27  if(matA.m!=matB.m || matA.n!=matB.n){
28  ERROR_REPORT;
29  std::cerr << "These two matrises can not make a subtraction." << std::endl
30  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
31  exit(1);
32  }
33 #endif//CPPL_DEBUG
34 
35  zgematrix newmat(matA);
36  for(CPPL_INT c=0; c<matB.vol; c++){
37  newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c];
38  }
39 
40  return _(newmat);
41 }
42 
43 //=============================================================================
44 /*! zgematrix*zhematrix operator */
45 inline _zgematrix operator*(const zgematrix& matA, const zhematrix& matB)
46 {CPPL_VERBOSE_REPORT;
47 #ifdef CPPL_DEBUG
48  if(matA.n!=matB.m){
49  ERROR_REPORT;
50  std::cerr << "These two matrises can not make a product." << std::endl
51  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
52  exit(1);
53  }
54 #endif//CPPL_DEBUG
55 
56  zgematrix newmat(matA.m, matB.n);
57  newmat.zero();
58 
59  for(CPPL_INT c=0; c<matB.vol; c++){
60  for(CPPL_INT i=0; i<matA.m; i++){
61  newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c];
62  }
63  }
64 
65  return _(newmat);
66 }
_zgematrix operator-(const zgematrix &matA, const zhematrix &matB)
_zgematrix operator*(const zgematrix &matA, const zhematrix &matB)
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
CPPL_INT const & m
matrix row size
Definition: zhematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
zgematrix & zero()
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
(DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class
Definition: _zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
_zgematrix operator+(const zgematrix &matA, const zhematrix &matB)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_dcovector _(dcovector &vec)