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  return _(newmat);
18 }
19 
20 //=============================================================================
22 inline _dgematrix i(const dgbmatrix& mat)
23 {
24 #ifdef CPPL_VERBOSE
25  std::cerr << "# [MARK] i(const dgbmatrix&)"
26  << std::endl;
27 #endif//CPPL_VERBOSE
28 
29 #ifdef CPPL_DEBUG
30  if(mat.M!=mat.N){
31  std::cerr << "[ERROR] i(dgbmatrix&) " << 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  dgbmatrix mat_cp(mat);
41  dgematrix mat_inv(mat.M,mat.N);
42  mat_inv.identity();
43  mat_cp.dgbsv(mat_inv);
44 
45  return _(mat_inv);
46 }
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
void identity()
Definition: dgematrix-misc.hpp:38
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