CPPLapack
 All Classes Files Functions Variables Friends
Functions
dgbmatrix-calc.hpp File Reference

Go to the source code of this file.

Functions

_dgbmatrix t (const dgbmatrix &mat)
_dgematrix i (const dgbmatrix &mat)

Function Documentation

_dgbmatrix t ( const dgbmatrix mat) [inline]

return transposed dgbmatrix

Definition at line 3 of file dgbmatrix-calc.hpp.

References _(), i(), dgbmatrix::kl, dgbmatrix::ku, dgbmatrix::m, and dgbmatrix::n.

{VERBOSE_REPORT;
  dgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
  for(long i=0; i<newmat.m; i++){
    for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){
      newmat(i,j) =mat(j,i);
    }
  }
  
  return _(newmat);
}
_dgematrix i ( const dgbmatrix mat) [inline]

return its inverse matrix

Definition at line 17 of file dgbmatrix-calc.hpp.

References _(), dgbmatrix::dgbsv(), dgematrix::identity(), dgbmatrix::m, and dgbmatrix::n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.m!=mat.n){
    ERROR_REPORT;
    std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
              << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgbmatrix mat_cp(mat);
  dgematrix mat_inv(mat.m,mat.n);
  mat_inv.identity();
  mat_cp.dgbsv(mat_inv);
  
  return _(mat_inv);
}
 All Classes Files Functions Variables Friends