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