00001
00003 inline _dgematrix t(const _dgematrix& mat)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] t(const _dgematrix&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 dgematrix newmat(mat.N,mat.M);
00011
00012 for(long i=0; i<newmat.m; i++){ for(long j=0; j<newmat.n; j++){
00013 newmat(i,j) =mat(j,i);
00014 }}
00015
00016 mat.destroy();
00017 return _(newmat);
00018 }
00019
00020
00022 inline _dgematrix i(const _dgematrix& mat)
00023 {
00024 #ifdef CPPL_VERBOSE
00025 std::cerr << "# [MARK] i(const _dgematrix&)"
00026 << std::endl;
00027 #endif//CPPL_VERBOSE
00028
00029 #ifdef CPPL_DEBUG
00030 if(mat.M!=mat.N){
00031 std::cerr << "[ERROR] i(_dgematrix&) " << std::endl
00032 << "This matrix is not square and has no inverse matrix."
00033 << std::endl
00034 << "Your input was (" << mat.M << "x" << mat.N << ")."
00035 << std::endl;
00036 exit(1);
00037 }
00038 #endif//CPPL_DEBUG
00039 dgematrix mat_cp;
00040 mat_cp.shallow_copy(mat);
00041
00042 dgematrix mat_inv(mat.M,mat.N);
00043 mat_inv.identity();
00044 mat_cp.dgesv(mat_inv);
00045
00046 return _(mat_inv);
00047 }
00048
00052
00053
00056 inline void idamax(long& i, long& j, const _dgematrix& mat)
00057 {
00058 #ifdef CPPL_VERBOSE
00059 std::cerr << "# [MARK] idamax(long&, long&, const _dgematrix&)"
00060 << std::endl;
00061 #endif//CPPL_VERBOSE
00062
00063 long index( idamax_(mat.M*mat.N, mat.Array, 1) -1 );
00064 i =index%mat.M;
00065 j =index/mat.M;
00066
00067 mat.destroy();
00068 }
00069
00070
00072 inline double damax(const _dgematrix& mat)
00073 {
00074 #ifdef CPPL_VERBOSE
00075 std::cerr << "# [MARK] damax(const _dgematrix&)"
00076 << std::endl;
00077 #endif//CPPL_VERBOSE
00078
00079 double val( mat.Array[idamax_(mat.M*mat.N, mat.Array, 1) -1] );
00080
00081 mat.destroy();
00082 return val;
00083 }