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

Go to the source code of this file.

Functions

_zgbmatrix t (const zgbmatrix &mat)
 
_zgematrix i (const zgbmatrix &mat)
 
_zgbmatrix conj (const zgbmatrix &mat)
 
_zgbmatrix conjt (const zgbmatrix &mat)
 

Function Documentation

_zgbmatrix t ( const zgbmatrix mat)
inline

return transposed zgbmatrix

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

References _(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, and zgbmatrix::n.

4 {CPPL_VERBOSE_REPORT;
5  zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
6 
7  for(CPPL_INT i=0; i<newmat.m; i++){
8  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
9  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
10  newmat(i,j) =mat(j,i);
11  }
12  }
13 
14  return _(newmat);
15 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
_zgematrix i(const zgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_dcovector _(dcovector &vec)
_zgematrix i ( const zgbmatrix mat)
inline

return its inverse matrix

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

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

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  zgbmatrix mat_cp(mat);
31  zgematrix mat_inv(mat.m,mat.n);
32  mat_inv.identity();
33  mat_cp.zgbsv(mat_inv);
34 
35  return _(mat_inv);
36 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
_dcovector _(dcovector &vec)
_zgbmatrix conj ( const zgbmatrix mat)
inline

return its conjugate matrix

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

References _(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, and zgbmatrix::n.

Referenced by conjt().

45 {CPPL_VERBOSE_REPORT;
46  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
47 
48  for(CPPL_INT i=0; i<mat.m; i++){
49  const CPPL_INT jmax =std::min(mat.n,i+mat.ku+1);
50  for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){
51  newmat(i,j) =std::conj(mat(i,j));
52  }
53  }
54 
55  return _(newmat);
56 }
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
_zgematrix i(const zgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgbmatrix conj(const zgbmatrix &mat)
_dcovector _(dcovector &vec)
_zgbmatrix conjt ( const zgbmatrix mat)
inline

return its conjugate transposed zgbmatrix

Definition at line 60 of file zgbmatrix-calc.hpp.

References _(), conj(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, and zgbmatrix::n.

61 {CPPL_VERBOSE_REPORT;
62  zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
63 
64  for(CPPL_INT i=0; i<newmat.m; i++){
65  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
66  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
67  newmat(i,j) =std::conj(mat(j,i));
68  }
69  }
70 
71  return _(newmat);
72 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
_zgematrix i(const zgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgbmatrix conj(const zgbmatrix &mat)
_dcovector _(dcovector &vec)