My Project
_dgbmatrix-calc.hpp
1 //=============================================================================
3 inline _dgbmatrix t(const _dgbmatrix& mat)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] t(const _dgbmatrix&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10  dgbmatrix 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  mat.destroy();
18  return _(newmat);
19 }
20 
21 //=============================================================================
23 inline _dgematrix i(const _dgbmatrix& mat)
24 {
25 #ifdef CPPL_VERBOSE
26  std::cerr << "# [MARK] i(const _dgbmatrix&)"
27  << std::endl;
28 #endif//CPPL_VERBOSE
29 
30 #ifdef CPPL_DEBUG
31  if(mat.M!=mat.N){
32  std::cerr << "[ERROR] i(_dgbmatrix&) " << std::endl
33  << "This matrix is not square and has no inverse matrix."
34  << std::endl
35  << "Your input was (" << mat.M << "x" << mat.N << ")."
36  << std::endl;
37  exit(1);
38  }
39 #endif//CPPL_DEBUG
40  dgbmatrix mat_cp;
41  mat_cp.shallow_copy(mat);
42 
43  dgematrix mat_inv(mat.M,mat.N);
44  mat_inv.identity();
45 
46  mat_cp.dgbsv(mat_inv);
47 
48  return _(mat_inv);
49 }
long KL
lower band width
Definition: _dgbmatrix.hpp:9
void shallow_copy(const _dgbmatrix &)
Definition: dgbmatrix-misc.hpp:107
long M
matrix row size
Definition: _dgbmatrix.hpp:7
void destroy() const
Definition: _dgbmatrix-misc.hpp:3
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
long N
matrix column size
Definition: _dgbmatrix.hpp:8
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
friend _dcovector t(const drovector &)
Definition: drovector-calc.hpp:3
Real Double-precision General Band Matrix Class.
Definition: dgbmatrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
Definition: _dgbmatrix.hpp:3
long dgbsv(dgematrix &)
Definition: dgbmatrix-lapack.hpp:5
long KU
upper band width
Definition: _dgbmatrix.hpp:10