CPPLapack
 All Classes Files Functions Variables Friends
_dgbmatrix-calc.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! return its transposed dgbmatrix */
00003 inline _dgbmatrix t(const _dgbmatrix& mat)
00004 {VERBOSE_REPORT;
00005   dgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
00006   
00007   for(long i=0; i<newmat.m; i++){
00008     for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){
00009       newmat(i,j) =mat(j,i);
00010     }
00011   }
00012   
00013   mat.destroy();
00014   return _(newmat);
00015 }
00016 
00017 //=============================================================================
00018 /*! return its inverse matrix */
00019 inline _dgematrix i(const _dgbmatrix& mat)
00020 {VERBOSE_REPORT;
00021 #ifdef  CPPL_DEBUG
00022   if(mat.m!=mat.n){
00023     ERROR_REPORT;
00024     std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
00025               << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
00026     exit(1);
00027   }
00028 #endif//CPPL_DEBUG
00029   
00030   dgbmatrix mat_cp(mat);
00031   dgematrix mat_inv(mat_cp.m,mat_cp.n);
00032   mat_inv.identity();
00033   mat_cp.dgbsv(mat_inv);
00034 
00035   return _(mat_inv);
00036 }
 All Classes Files Functions Variables Friends