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 _(), i(), zgematrix::m, 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  return _(newmat);
14 }
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
_zgematrix i(const zgematrix &mat)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix i ( const zgematrix mat)
inline

return its inverse matrix

Definition at line 18 of file zgematrix-calc.hpp.

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

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

19 {CPPL_VERBOSE_REPORT;
20 #ifdef CPPL_DEBUG
21  if(mat.m!=mat.n){
22  ERROR_REPORT;
23  std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
24  << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
25  exit(1);
26  }
27 #endif//CPPL_DEBUG
28 
29  zgematrix mat_cp(mat), mat_inv(mat.m,mat.n);
30  mat_inv.identity();
31  mat_cp.zgesv(mat_inv);
32 
33  return _(mat_inv);
34 }
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: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix conj ( const zgematrix mat)
inline

return its conjugate matrix

Definition at line 42 of file zgematrix-calc.hpp.

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

Referenced by conjt().

43 {CPPL_VERBOSE_REPORT;
44  zgematrix newmat(mat.m,mat.n);
45 
46  for(CPPL_INT i=0; i<mat.m; i++){
47  for(CPPL_INT j=0; j<mat.n; j++){
48  newmat(i,j) =std::conj(mat(i,j));
49  }
50  }
51 
52  return _(newmat);
53 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
_zgematrix i(const zgematrix &mat)
_zgematrix conj(const zgematrix &mat)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
_zgematrix conjt ( const zgematrix mat)
inline

return its conjugate transposed matrix

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

References _(), conj(), i(), zgematrix::m, 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  return _(newmat);
68 }
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
_zgematrix i(const zgematrix &mat)
_zgematrix conj(const zgematrix &mat)
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
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 77 of file zgematrix-calc.hpp.

References zgematrix::array, zgematrix::m, and zgematrix::n.

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

return its largest absolute value

Definition at line 88 of file zgematrix-calc.hpp.

References zgematrix::array, zgematrix::m, and zgematrix::n.

89 {CPPL_VERBOSE_REPORT;
90  CPPL_INT size =mat.m*mat.n;
91  CPPL_INT inc =1;
92  return mat.array[izamax_(&size, mat.array, &inc) -1];
93 }
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgematrix.hpp:11
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9