Go to the documentation of this file.00001
00002
00003 inline _dgematrix t(const _dgematrix& mat)
00004 {VERBOSE_REPORT;
00005 dgematrix newmat(mat.n,mat.m);
00006
00007 for(long i=0; i<newmat.m; i++){
00008 for(long j=0; j<newmat.n; j++){
00009 newmat(i,j) =mat(j,i);
00010 }
00011 }
00012
00013 mat.destroy();
00014 return _(newmat);
00015 }
00016
00017
00018
00019 inline _dgematrix i(const _dgematrix& 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 dgematrix mat_cp(mat);
00031 dgematrix mat_inv(mat_cp.m,mat_cp.n);
00032 mat_inv.identity();
00033 mat_cp.dgesv(mat_inv);
00034
00035 return _(mat_inv);
00036 }
00037
00038
00039
00040
00041
00042
00043
00044
00045 inline void idamax(long& i, long& j, const _dgematrix& mat)
00046 {VERBOSE_REPORT;
00047 long index( idamax_(mat.m*mat.n, mat.array, 1) -1 );
00048 i =index%mat.m;
00049 j =index/mat.m;
00050
00051 mat.destroy();
00052 }
00053
00054
00055
00056 inline double damax(const _dgematrix& mat)
00057 {VERBOSE_REPORT;
00058 double val( mat.array[idamax_(mat.m*mat.n, mat.array, 1) -1] );
00059
00060 mat.destroy();
00061 return val;
00062 }