My Project
zgbmatrix-calc.hpp
1 //=============================================================================
3 inline _zgbmatrix t(const zgbmatrix& mat)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] t(const zgbmatrix&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10  zgbmatrix newmat(mat.N, mat.M, mat.KU, mat.KL);
11  for(long i=0; i<newmat.M; i++){
12  for(long j=max(0,i-newmat.KL); j<min(newmat.N,i+newmat.KU+1); j++){
13  newmat(i,j) =mat(j,i);
14  }
15  }
16 
17  return _(newmat);
18 }
19 
20 //=============================================================================
22 inline _zgematrix i(const zgbmatrix& mat)
23 {
24 #ifdef CPPL_VERBOSE
25  std::cerr << "# [MARK] i(const zgbmatrix&)"
26  << std::endl;
27 #endif//CPPL_VERBOSE
28 
29 #ifdef CPPL_DEBUG
30  if(mat.M!=mat.N){
31  std::cerr << "[ERROR] i(zgbmatrix&) " << std::endl
32  << "This matrix is not square and has no inverse matrix."
33  << std::endl
34  << "Your input was (" << mat.M << "x" << mat.N << ")."
35  << std::endl;
36  exit(1);
37  }
38 #endif//CPPL_DEBUG
39 
40  zgbmatrix mat_cp(mat);
41  zgematrix mat_inv(mat.M,mat.N);
42  mat_inv.identity();
43  mat_cp.zgbsv(mat_inv);
44 
45  return _(mat_inv);
46 }
47 
51 
52 //=============================================================================
54 inline _zgbmatrix conj(const zgbmatrix& mat)
55 {
56 #ifdef CPPL_VERBOSE
57  std::cerr << "# [MARK] conj(const zgbmatrix& mat)"
58  << std::endl;
59 #endif//CPPL_VERBOSE
60 
61  zgbmatrix newmat(mat.M, mat.N, mat.KL, mat.KU);
62  for(long i=0; i<mat.M; i++){
63  for(long j=max(0,i-mat.KL); j<min(mat.N,i+mat.KU+1); j++){
64  newmat(i,j) =std::conj(mat(i,j));
65  }
66  }
67  return _(newmat);
68 }
69 
70 //=============================================================================
72 inline _zgbmatrix conjt(const zgbmatrix& mat)
73 {
74 #ifdef CPPL_VERBOSE
75  std::cerr << "# [MARK] conjt(const zgbmatrix&)"
76  << std::endl;
77 #endif//CPPL_VERBOSE
78 
79  zgbmatrix newmat(mat.N, mat.M, mat.KU, mat.KL);
80  for(long i=0; i<newmat.m; i++){
81  for(long j=max(0,i-newmat.kl); j<min(newmat.n,i+newmat.ku+1); j++){
82  newmat(i,j) =std::conj(mat(j,i));
83  }
84  }
85  return _(newmat);
86 }
void identity()
Definition: zgematrix-misc.hpp:38
long zgbsv(zgematrix &)
Definition: zgbmatrix-lapack.hpp:5
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
friend _zcovector conjt(const _zrovector &)
Definition: _zrovector-calc.hpp:33
(DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class
Definition: _zgematrix.hpp:3
friend _zrovector conj(const _zrovector &)
Definition: _zrovector-calc.hpp:20
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
long const & kl
lower band width (readable)
Definition: zgbmatrix.hpp:18
friend _zcovector t(const _zrovector &)
Definition: _zrovector-calc.hpp:3
long const & n
matrix column size (readable)
Definition: zgbmatrix.hpp:17
long const & m
matrix row size (readable)
Definition: zgbmatrix.hpp:16
long const & ku
upper band width (readable)
Definition: zgbmatrix.hpp:19