CPPLapack
 All Classes Files Functions Variables Friends Pages
zhematrix-_zhematrix.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! zhematrix=_zhematrix operator */
4 {CPPL_VERBOSE_REPORT;
5  shallow_copy(mat);
6  return *this;
7 }
8 
9 ///////////////////////////////////////////////////////////////////////////////
10 ///////////////////////////////////////////////////////////////////////////////
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 //=============================================================================
14 /*! zhematrix+=_zhematrix operator */
16 {CPPL_VERBOSE_REPORT;
17 #ifdef CPPL_DEBUG
18  if(n!=mat.n){
19  ERROR_REPORT;
20  std::cerr << "These two matrises can not make a summation." << std::endl
21  << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
22  exit(1);
23  }
24 #endif//CPPL_DEBUG
25 
26  for(CPPL_INT j=0; j<n; j++){
27  for(CPPL_INT i=j; i<n; i++){
28  darray[j][i] += mat.darray[j][i];
29  }
30  }
31 
32  mat.destroy();
33  return *this;
34 }
35 
36 //=============================================================================
37 /*! zhematrix-=_zhematrix operator */
39 {CPPL_VERBOSE_REPORT;
40 #ifdef CPPL_DEBUG
41  if(n!=mat.n){
42  ERROR_REPORT;
43  std::cerr << "These two matrises can not make a sutraction." << std::endl
44  << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
45  exit(1);
46  }
47 #endif//CPPL_DEBUG
48 
49  for(CPPL_INT j=0; j<n; j++){
50  for(CPPL_INT i=j; i<n; i++){
51  darray[j][i] -= mat.darray[j][i];
52  }
53  }
54 
55  mat.destroy();
56  return *this;
57 }
58 
59 ///////////////////////////////////////////////////////////////////////////////
60 ///////////////////////////////////////////////////////////////////////////////
61 ///////////////////////////////////////////////////////////////////////////////
62 
63 //=============================================================================
64 /*! zhematrix+_zhematrix operator */
65 inline _zhematrix operator+(const zhematrix& matA, const _zhematrix& matB)
66 {CPPL_VERBOSE_REPORT;
67 #ifdef CPPL_DEBUG
68  if(matA.n!=matB.n){
69  ERROR_REPORT;
70  std::cerr << "These two matrises can not make a summation." << std::endl
71  << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
72  exit(1);
73  }
74 #endif//CPPL_DEBUG
75 
76  for(CPPL_INT j=0; j<matA.n; j++){
77  for(CPPL_INT i=j; i<matA.n; i++){
78  matB.darray[j][i] += matA.darray[j][i];
79  }
80  }
81 
82  return matB;
83 }
84 
85 //=============================================================================
86 /*! zhematrix-_zhematrix operator */
87 inline _zhematrix operator-(const zhematrix& matA, const _zhematrix& matB)
88 {CPPL_VERBOSE_REPORT;
89 #ifdef CPPL_DEBUG
90  if(matA.n!=matB.n){
91  ERROR_REPORT;
92  std::cerr << "These two matrises can not make a subtraction." << std::endl
93  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
94  exit(1);
95  }
96 #endif//CPPL_DEBUG
97 
98  for(CPPL_INT j=0; j<matA.n; j++){
99  for(CPPL_INT i=j; i<matA.n; i++){
100  matB.darray[j][i] =matA.darray[j][i]-matB.darray[j][i];
101  }
102  }
103 
104  return matB;
105 }
106 
107 //=============================================================================
108 /*! zhematrix*_zhematrix operator */
109 inline _zgematrix operator*(const zhematrix& matA, const _zhematrix& matB)
110 {CPPL_VERBOSE_REPORT;
111 #ifdef CPPL_DEBUG
112  if(matA.n!=matB.n){
113  ERROR_REPORT;
114  std::cerr << "These two matrises can not make a product." << std::endl
115  << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
116  exit(1);
117  }
118 #endif//CPPL_DEBUG
119 
120  matB.complete();
121 
122  zgematrix newmat( matA.n, matB.n );
123  char side ='l';
124  char uplo ='l';
125  comple alpha =comple(1.,0.);
126  comple beta =comple(0.,0.);
127 
128  zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m );
129 
130  matB.destroy();
131  return _(newmat);
132 }
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Matrix Class
Definition: _zhematrix.hpp:3
void shallow_copy(const _zhematrix &)
zhematrix & operator+=(const zhematrix &)
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
_zhematrix operator-(const zhematrix &matA, const _zhematrix &matB)
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
(DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class
Definition: _zgematrix.hpp:3
friend _zgematrix i(const zhematrix &)
void complete() const
comple * array
1D array to store matrix data
Definition: zhematrix.hpp:12
_zhematrix operator+(const zhematrix &matA, const _zhematrix &matB)
comple * array
1D array to store matrix data
Definition: _zhematrix.hpp:12
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_zgematrix operator*(const zhematrix &matA, const _zhematrix &matB)
zhematrix & operator=(const zhematrix &)
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
comple ** darray
array of pointers of column head addresses
Definition: zhematrix.hpp:13
comple ** darray
array of pointers of column head addresses
Definition: _zhematrix.hpp:13
zhematrix & operator-=(const zhematrix &)
_dcovector _(dcovector &vec)