CPPLapack
 All Classes Files Functions Variables Friends Pages
zgbmatrix-calc.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! return transposed zgbmatrix */
3 inline _zgbmatrix t(const zgbmatrix& mat)
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 }
16 
17 //=============================================================================
18 /*! return its inverse matrix */
19 inline _zgematrix i(const zgbmatrix& mat)
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 }
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////
41 
42 //=============================================================================
43 /*! return its conjugate matrix */
44 inline _zgbmatrix conj(const zgbmatrix& mat)
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 }
57 
58 //=============================================================================
59 /*! return its conjugate transposed zgbmatrix */
60 inline _zgbmatrix conjt(const zgbmatrix& mat)
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 zgbsv(zgematrix &)
zgematrix & identity()
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
_zgbmatrix conjt(const zgbmatrix &mat)
(DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class
Definition: _zgematrix.hpp:3
_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
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgbmatrix t(const zgbmatrix &mat)
_zgbmatrix conj(const zgbmatrix &mat)
_dcovector _(dcovector &vec)