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 89 of file zgematrix-_zgematrix.hpp.

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

90 {CPPL_VERBOSE_REPORT;
91 #ifdef CPPL_DEBUG
92  if(matA.n!=matB.n || matA.m!=matB.m){
93  ERROR_REPORT;
94  std::cerr << "These two matrises can not make a summation." << std::endl
95  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
96  exit(1);
97  }
98 #endif//CPPL_DEBUG
99 
100  const CPPL_INT size =matA.m*matA.n;
101  for(CPPL_INT i=0; i<size; i++){
102  matB.array[i] +=matA.array[i];
103  }
104 
105  return matB;
106 }
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 110 of file zgematrix-_zgematrix.hpp.

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

111 {CPPL_VERBOSE_REPORT;
112 #ifdef CPPL_DEBUG
113  if(matA.n!=matB.n || matA.m!=matB.m){
114  ERROR_REPORT;
115  std::cerr << "These two matrises can not make a subtraction." << std::endl
116  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  const CPPL_INT size =matA.m*matA.n;
122  for(CPPL_INT i=0; i<size; i++){
123  matB.array[i] =matA.array[i]-matB.array[i];
124  }
125 
126  return matB;
127 }
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 131 of file zgematrix-_zgematrix.hpp.

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

132 {CPPL_VERBOSE_REPORT;
133 #ifdef CPPL_DEBUG
134  if(matA.n!=matB.m){
135  ERROR_REPORT;
136  std::cerr << "These two matrises can not make a product." << std::endl
137  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
138  exit(1);
139  }
140 #endif//CPPL_DEBUG
141 
142  zgematrix newmat( matA.m, matB.n );
143  char transa ='n';
144  char transb ='n';
145  comple alpha =comple(1.,0.);
146  comple beta =comple(0.,0.);
147 
148  zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m );
149 
150  matB.destroy();
151  return _(newmat);
152 }
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