00001
00003 inline _dgematrix operator+(const _dgematrix& matA, const dgematrix& matB)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] operator+(const _dgematrix&, const dgematrix&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 #ifdef CPPL_DEBUG
00011 if(matA.N!=matB.N || matA.M!=matB.M){
00012 std::cerr << "[ERROR] operator+(_dgematrix&, dgematrix&)" << std::endl
00013 << "These two matrises can not make a summation." << std::endl
00014 << "Your input was (" << matA.M << "x" << matA.N << ") + ("
00015 << matB.M << "x" << matB.N << ")." << std::endl;
00016 exit(1);
00017 }
00018 #endif//CPPL_DEBUG
00019
00020 for(long i=0; i<matA.M*matA.N; i++){ matA.Array[i]+=matB.Array[i]; }
00021
00022 return matA;
00023 }
00024
00025
00027 inline _dgematrix operator-(const _dgematrix& matA, const dgematrix& matB)
00028 {
00029 #ifdef CPPL_VERBOSE
00030 std::cerr << "# [MARK] operator-(const _dgematrix&, const dgematrix&)"
00031 << std::endl;
00032 #endif//CPPL_VERBOSE
00033
00034 #ifdef CPPL_DEBUG
00035 if(matA.N!=matB.N || matA.M!=matB.M){
00036 std::cerr << "[ERROR] operator-(_dgematrix&, dgematrix&)" << std::endl
00037 << "These two matrises can not make a subtraction." << std::endl
00038 << "Your input was (" << matA.M << "x" << matA.N << ") - ("
00039 << matB.M << "x" << matB.N << ")." << std::endl;
00040 exit(1);
00041 }
00042 #endif//CPPL_DEBUG
00043
00044 for(long i=0; i<matA.M*matA.N; i++){ matA.Array[i]-=matB.Array[i]; }
00045
00046 return matA;
00047 }
00048
00049
00051 inline _dgematrix operator*(const _dgematrix& matA, const dgematrix& matB)
00052 {
00053 #ifdef CPPL_VERBOSE
00054 std::cerr << "# [MARK] operator*(const _dgematrix&, const dgematrix&)"
00055 << std::endl;
00056 #endif//CPPL_VERBOSE
00057
00058 #ifdef CPPL_DEBUG
00059 if(matA.N!=matB.M){
00060 std::cerr << "[ERROR] operator*(_dgematrix&, dgematrix&)" << std::endl
00061 << "These two matrises can not make a product." << std::endl
00062 << "Your input was (" << matA.M << "x" << matA.N << ") * ("
00063 << matB.M << "x" << matB.N << ")." << std::endl;
00064 exit(1);
00065 }
00066 #endif//CPPL_DEBUG
00067
00068 dgematrix newmat( matA.M, matB.N );
00069 dgemm_( 'N', 'N', matA.M, matB.N, matA.N, 1.0, matA.Array, matA.M,
00070 matB.Array, matB.M, 0.0, newmat.array, matA.M );
00071
00072 matA.destroy();
00073 return _(newmat);
00074 }