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

Go to the source code of this file.

Functions

_zgematrix t (const _zgematrix &mat)
 
_zgematrix i (const _zgematrix &mat)
 
_zgematrix conj (const _zgematrix &mat)
 
_zgematrix conjt (const _zgematrix &mat)
 
void idamax (CPPL_INT &i, CPPL_INT &j, const _zgematrix &mat)
 
comple damax (const _zgematrix &mat)
 

Function Documentation

_zgematrix t ( const _zgematrix mat)
inline

return transposed zgematrix

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

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

4 {CPPL_VERBOSE_REPORT;
5  zgematrix newmat(mat.n,mat.m);
6 
7  for(CPPL_INT i=0; i<newmat.m; i++){
8  for(CPPL_INT j=0; j<newmat.n; j++){
9  newmat(i,j) =mat(j,i);
10  }
11  }
12 
13  mat.destroy();
14  return _(newmat);
15 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_zgematrix i(const _zgematrix &mat)
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
void destroy() const
_dcovector _(dcovector &vec)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix i ( const _zgematrix mat)
inline

return its inverse matrix

Definition at line 19 of file _zgematrix-calc.hpp.

References _(), zgematrix::identity(), _zgematrix::m, zgematrix::m, zgematrix::n, _zgematrix::n, and zgematrix::zgesv().

Referenced by conj(), conjt(), and t().

20 {CPPL_VERBOSE_REPORT;
21 #ifdef CPPL_DEBUG
22  if(mat.m!=mat.n){
23  ERROR_REPORT;
24  std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
25  << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
26  exit(1);
27  }
28 #endif//CPPL_DEBUG
29 
30  zgematrix mat_cp(mat);
31  zgematrix mat_inv(mat_cp.m,mat_cp.n);
32  mat_inv.identity();
33  mat_cp.zgesv(mat_inv);
34 
35  return _(mat_inv);
36 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
_dcovector _(dcovector &vec)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix conj ( const _zgematrix mat)
inline

return its conjugate matrix

Definition at line 44 of file _zgematrix-calc.hpp.

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

Referenced by conjt().

45 {CPPL_VERBOSE_REPORT;
46  for(CPPL_INT i=0; i<mat.m; i++){
47  for(CPPL_INT j=0; j<mat.n; j++){
48  mat(i,j) =std::conj(mat(i,j));
49  }
50  }
51 
52  return mat;
53 }
_zgematrix conj(const _zgematrix &mat)
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_zgematrix i(const _zgematrix &mat)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
_zgematrix conjt ( const _zgematrix mat)
inline

return its conjugate transposed matrix

Definition at line 57 of file _zgematrix-calc.hpp.

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

58 {CPPL_VERBOSE_REPORT;
59  zgematrix newmat(mat.n,mat.m);
60 
61  for(CPPL_INT i=0; i<newmat.m; i++){
62  for(CPPL_INT j=0; j<newmat.n; j++){
63  newmat(i,j) =std::conj(mat(j,i));
64  }
65  }
66 
67  mat.destroy();
68  return _(newmat);
69 }
_zgematrix conj(const _zgematrix &mat)
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_zgematrix i(const _zgematrix &mat)
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
void destroy() const
_dcovector _(dcovector &vec)
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const _zgematrix mat 
)
inline

search the index of element having the largest absolute value in 0-based numbering system

Definition at line 78 of file _zgematrix-calc.hpp.

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

79 {CPPL_VERBOSE_REPORT;
80  CPPL_INT size =mat.m*mat.n;
81  CPPL_INT inc =1;
82  CPPL_INT index =izamax_(&size, mat.array, &inc) -1;
83  i =index%mat.m;
84  j =index/mat.m;
85 
86  mat.destroy();
87 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_zgematrix i(const _zgematrix &mat)
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
comple damax ( const _zgematrix mat)
inline

return its largest absolute value

Definition at line 91 of file _zgematrix-calc.hpp.

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

92 {CPPL_VERBOSE_REPORT;
93  CPPL_INT size =mat.m*mat.n;
94  CPPL_INT inc =1;
95  comple val =mat.array[izamax_(&size, mat.array, &inc) -1];
96 
97  mat.destroy();
98  return val;
99 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10