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