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 return matA;
00023 }
00024
00025
00027 inline _dsymatrix operator-(const _dsymatrix& matA, const dsymatrix& matB)
00028 {
00029 #ifdef CPPL_VERBOSE
00030 std::cerr << "# [MARK] operator-(const _dsymatrix&, const dsymatrix&)"
00031 << std::endl;
00032 #endif//CPPL_VERBOSE
00033
00034 #ifdef CPPL_DEBUG
00035 if(matA.N!=matB.N){
00036 std::cerr << "[ERROR] operator-(_dsymatrix&, dsymatrix&)" << std::endl
00037 << "These two matrises can not make a subtraction." << std::endl
00038 << "Your input was (" << matA.N << "x" << matA.N << ") - ("
00039 << matB.N << "x" << matB.N << ")." << std::endl;
00040 exit(1);
00041 }
00042 #endif//CPPL_DEBUG
00043
00044 for(long i=0; i<matA.N*matA.N; i++){ matA.Array[i]-=matB.Array[i]; }
00045
00046 return matA;
00047 }
00048
00049
00051 inline _dgematrix operator*(const _dsymatrix& matA, const dsymatrix& matB)
00052 {
00053 #ifdef CPPL_VERBOSE
00054 std::cerr << "# [MARK] operator*(const _dsymatrix&, const dsymatrix&)"
00055 << std::endl;
00056 #endif//CPPL_VERBOSE
00057
00058 #ifdef CPPL_DEBUG
00059 if(matA.N!=matB.N){
00060 std::cerr << "[ERROR] operator*(_dsymatrix&, dsymatrix&)" << std::endl
00061 << "These two matrises can not make a product." << std::endl
00062 << "Your input was (" << matA.N << "x" << matA.N << ") * ("
00063 << matB.N << "x" << matB.N << ")." << std::endl;
00064 exit(1);
00065 }
00066 #endif//CPPL_DEBUG
00067
00068 matA.complete();
00069 matB.complete();
00070 dgematrix newmat(matA.N, matA.N);
00071
00072 dgemm_( 'N', 'N', matA.N, matB.N, matA.N, 1.0, matA.Array, matA.N,
00073 matB.Array, matB.N, 0.0, newmat.array, matA.N );
00074
00075 matA.destroy();
00076 return _(newmat);
00077 }