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