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