CPPLapack
 All Classes Files Functions Variables Friends
_dsymatrix-calc.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! return transposed _dsymatrix */
00003 inline _dsymatrix t(const _dsymatrix& mat)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   WARNING_REPORT;
00007   std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl;
00008 #endif//CPPL_DEBUG
00009   
00010   return mat;
00011 }
00012 
00013 //=============================================================================
00014 /*! return its inverse matrix */
00015 inline _dsymatrix i(const _dsymatrix& mat)
00016 {VERBOSE_REPORT;
00017   dsymatrix mat_cp(mat);
00018   dsymatrix mat_inv(mat_cp.n);
00019   mat_inv.identity();
00020   
00021   char UPLO('l');
00022   long NRHS(mat.n), LDA(mat.n), *IPIV(new long[mat.n]), LDB(mat.n), LWORK(-1), INFO(1);
00023   double *WORK( new double[1] );
00024   dsysv_(UPLO, mat_cp.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO);
00025   LWORK = long(WORK[0]);
00026   delete [] WORK;  WORK = new double[LWORK];
00027   dsysv_(UPLO, mat_cp.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO);
00028   delete [] WORK; delete [] IPIV;
00029   if(INFO!=0){
00030     WARNING_REPORT;
00031     std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
00032   }
00033   
00034   return _(mat_inv);
00035 }
00036 
00037 ///////////////////////////////////////////////////////////////////////////////
00038 ///////////////////////////////////////////////////////////////////////////////
00039 ///////////////////////////////////////////////////////////////////////////////
00040 
00041 //=============================================================================
00042 /*! search the index of element having the largest absolute value
00043   in 0-based numbering system */
00044 inline void idamax(long& i, long& j, const _dsymatrix& mat)
00045 {VERBOSE_REPORT;
00046   dsymatrix newmat(mat);
00047   idamax(i, j, newmat);
00048 }
00049 
00050 //=============================================================================
00051 /*! return its largest absolute value */
00052 inline double damax(const _dsymatrix& mat)
00053 {VERBOSE_REPORT;
00054   dsymatrix newmat(mat);
00055   return damax(newmat);
00056 }
 All Classes Files Functions Variables Friends