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 return _(newmat);
00017 }
00018
00019
00021 inline _dgematrix i(const dgematrix& mat)
00022 {
00023 #ifdef CPPL_VERBOSE
00024 std::cerr << "# [MARK] i(const dgematrix&)"
00025 << std::endl;
00026 #endif//CPPL_VERBOSE
00027
00028 #ifdef CPPL_DEBUG
00029 if(mat.M!=mat.N){
00030 std::cerr << "[ERROR] i(dgematrix&) " << std::endl
00031 << "This matrix is not square and has no inverse matrix."
00032 << std::endl
00033 << "Your input was (" << mat.M << "x" << mat.N << ")."
00034 << std::endl;
00035 exit(1);
00036 }
00037 #endif//CPPL_DEBUG
00038
00039 dgematrix mat_cp(mat), mat_inv(mat.M,mat.N);
00040 mat_inv.identity();
00041 mat_cp.dgesv(mat_inv);
00042
00043 return _(mat_inv);
00044 }
00045
00049
00050
00053 inline void idamax(long& i, long& j, const dgematrix& mat)
00054 {
00055 #ifdef CPPL_VERBOSE
00056 std::cerr << "# [MARK] idamax(long&, long&, const dgematrix&)"
00057 << std::endl;
00058 #endif//CPPL_VERBOSE
00059
00060 long index( idamax_(mat.M*mat.N, mat.Array, 1) -1 );
00061 i =index%mat.M;
00062 j =index/mat.M;
00063 }
00064
00065
00067 inline double damax(const dgematrix& mat)
00068 {
00069 #ifdef CPPL_VERBOSE
00070 std::cerr << "# [MARK] damax(const dgematrix&)"
00071 << std::endl;
00072 #endif//CPPL_VERBOSE
00073
00074 return mat.Array[idamax_(mat.M*mat.N, mat.Array, 1) -1];
00075 }