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)
 

Function Documentation

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

_zgematrix+zgematrix operator

Definition at line 3 of file _zgematrix-zgematrix.hpp.

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
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  const CPPL_INT size =matA.m*matA.n;
15  for(CPPL_INT i=0; i<size; i++){
16  matA.array[i] += matB.array[i];
17  }
18 
19  return matA;
20 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator- ( const _zgematrix matA,
const zgematrix matB 
)
inline

_zgematrix-zgematrix operator

Definition at line 24 of file _zgematrix-zgematrix.hpp.

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

25 {CPPL_VERBOSE_REPORT;
26 #ifdef CPPL_DEBUG
27  if(matA.n!=matB.n || matA.m!=matB.m){
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.m << "x" << matB.n << ")." << std::endl;
31  exit(1);
32  }
33 #endif//CPPL_DEBUG
34 
35  const CPPL_INT size =matA.m*matA.n;
36  for(CPPL_INT i=0; i<size; i++){
37  matA.array[i] -= matB.array[i];
38  }
39 
40  return matA;
41 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix operator* ( const _zgematrix matA,
const zgematrix matB 
)
inline

_zgematrix*zgematrix operator

Definition at line 45 of file _zgematrix-zgematrix.hpp.

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

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.m << "x" << matB.n << ")." << std::endl;
52  exit(1);
53  }
54 #endif//CPPL_DEBUG
55 
56  zgematrix newmat( matA.m, matB.n );
57  char transa ='n';
58  char transb ='n';
59  comple alpha =comple(1.,0.);
60  comple beta =comple(0.,0.);
61 
62  zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
63 
64  matA.destroy();
65  return _(newmat);
66 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
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
void destroy() const
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)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10