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