CPPLapack
 All Classes Files Functions Variables Friends Pages
dgbmatrix-calc.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! return transposed dgbmatrix */
3 inline _dgbmatrix t(const dgbmatrix& mat)
4 {CPPL_VERBOSE_REPORT;
5  dgbmatrix 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 _dgematrix i(const dgbmatrix& 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  dgbmatrix mat_cp(mat);
31  dgematrix mat_inv(mat.m,mat.n);
32  mat_inv.identity();
33  mat_cp.dgbsv(mat_inv);
34 
35  return _(mat_inv);
36 }
dgematrix & identity()
CPPL_INT m
matrix row size
Definition: dgbmatrix.hpp:9
_dgbmatrix t(const dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: dgbmatrix.hpp:11
CPPL_INT ku
upper band width
Definition: dgbmatrix.hpp:12
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
Real Double-precision General Band Matrix Class.
Definition: dgbmatrix.hpp:3
_dgematrix i(const dgbmatrix &mat)
CPPL_INT dgbsv(dgematrix &)
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
Definition: _dgbmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: dgbmatrix.hpp:10
_dcovector _(dcovector &vec)