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

Go to the source code of this file.

Functions

_zgematrix operator+ (const zgematrix &matA, const zgematrix &matB)
 
_zgematrix operator- (const zgematrix &matA, const zgematrix &matB)
 
_zgematrix operator* (const zgematrix &matA, const zgematrix &matB)
 
_zgematrix hadamerd (const zgematrix &matA, const zgematrix &matB)
 

Function Documentation

_zgematrix operator+ ( const zgematrix matA,
const zgematrix matB 
)
inline

zgematrix+zgematrix operator

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

References _(), zgematrix::array, i(), zgematrix::m, and zgematrix::n.

87 {CPPL_VERBOSE_REPORT;
88 #ifdef CPPL_DEBUG
89  if(matA.n!=matB.n || matA.m!=matB.m){
90  ERROR_REPORT;
91  std::cerr << "These two matrises can not make a summation." << std::endl
92  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
93  exit(1);
94  }
95 #endif//CPPL_DEBUG
96 
97  zgematrix newmat(matA.m,matA.n);
98 
99  const CPPL_INT size =matA.m*matA.n;
100  for(CPPL_INT i=0; i<size; i++){
101  newmat.array[i] =matA.array[i]+matB.array[i];
102  }
103 
104  return _(newmat);
105 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix operator- ( const zgematrix matA,
const zgematrix matB 
)
inline

zgematrix-zgematrix operator

Definition at line 109 of file zgematrix-zgematrix.hpp.

References _(), zgematrix::array, i(), zgematrix::m, and zgematrix::n.

110 {CPPL_VERBOSE_REPORT;
111 #ifdef CPPL_DEBUG
112  if(matA.n!=matB.n || matA.m!=matB.m){
113  ERROR_REPORT;
114  std::cerr << "These two matrises can not make a subtraction." << std::endl
115  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
116  exit(1);
117  }
118 #endif//CPPL_DEBUG
119 
120  zgematrix newmat(matA.m,matA.n);
121 
122  const CPPL_INT size =matA.m*matA.n;
123  for(CPPL_INT i=0; i<size; i++){
124  newmat.array[i] =matA.array[i]-matB.array[i];
125  }
126 
127  return _(newmat);
128 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix operator* ( const zgematrix matA,
const zgematrix matB 
)
inline

zgematrix*zgematrix operator

Definition at line 132 of file zgematrix-zgematrix.hpp.

References _(), zgematrix::array, zgematrix::m, and zgematrix::n.

133 {CPPL_VERBOSE_REPORT;
134 #ifdef CPPL_DEBUG
135  if(matA.n!=matB.m){
136  ERROR_REPORT;
137  std::cerr << "These two matrises can not make a product." << std::endl
138  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
139  exit(1);
140  }
141 #endif//CPPL_DEBUG
142 
143  zgematrix newmat( matA.m, matB.n );
144  char transa ='n';
145  char transb ='n';
146  comple alpha =comple(1.,0.);
147  comple beta =comple(0.,0.);
148 
149  zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
150 
151  return _(newmat);
152 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix hadamerd ( const zgematrix matA,
const zgematrix matB 
)
inline

return Hadamerd product

Definition at line 160 of file zgematrix-zgematrix.hpp.

References _(), i(), zgematrix::m, and zgematrix::n.

161 {CPPL_VERBOSE_REPORT;
162 #ifdef CPPL_DEBUG
163  if( matA.m!=matB.m || matA.n!=matB.n ){
164  ERROR_REPORT;
165  std::cerr << "These two matrices can not make Hadamerd product." << std::endl
166  << "Your input was (" << matA.m << "x" << matA.n << ") and (" << matB.m << "x" << matB.n << ")." << std::endl;
167  exit(1);
168  }
169 #endif//CPPL_DEBUG
170 
171  zgematrix newmat(matA.m,matA.n);
172 
173  for(CPPL_INT i=0; i<newmat.m; i++){
174  for(CPPL_INT j=0; j<newmat.n; j++){
175  newmat(i,j) =matA(i,j)*matB(i,j);
176  }
177  }
178 
179  return _(newmat);
180 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)