Go to the documentation of this file.00001
00002
00003 inline _zgematrix operator+(const zhematrix& matA, const zhematrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef CPPL_DEBUG
00006 if(matA.n!=matB.m || matA.n!=matB.n){
00007 ERROR_REPORT;
00008 std::cerr << "These two matrises can not make a summation." << std::endl
00009 << "Your input was (" << matA.n << "x" << matA.n << ") + ("
00010 << matB.m << "x" << matB.n << ")." << std::endl;
00011 exit(1);
00012 }
00013 #endif//CPPL_DEBUG
00014
00015 zgematrix newmat(matA);
00016 for(long c=0; c<matB.vol; c++){
00017 newmat(matB.indx[c],matB.jndx[c]) += matB.array[c];
00018 }
00019
00020 return _(newmat);
00021 }
00022
00023
00024
00025 inline _zgematrix operator-(const zhematrix& matA, const zhematrix& matB)
00026 {VERBOSE_REPORT;
00027 #ifdef CPPL_DEBUG
00028 if(matA.n!=matB.m || matA.n!=matB.n){
00029 ERROR_REPORT;
00030 std::cerr << "These two matrises can not make a subtraction." << std::endl
00031 << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
00032 exit(1);
00033 }
00034 #endif//CPPL_DEBUG
00035
00036 zgematrix newmat(matA);
00037 for(long c=0; c<matB.vol; c++){
00038 newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c];
00039 }
00040
00041 return _(newmat);
00042 }
00043
00044
00045
00046 inline _zgematrix operator*(const zhematrix& matA, const zhematrix& matB)
00047 {VERBOSE_REPORT;
00048 #ifdef CPPL_DEBUG
00049 if(matA.n!=matB.m){
00050 ERROR_REPORT;
00051 std::cerr << "These two matrises can not make a product." << std::endl
00052 << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
00053 exit(1);
00054 }
00055 #endif//CPPL_DEBUG
00056
00057 zgematrix newmat(matA.n, matB.n);
00058 newmat.zero();
00059
00060 for(long c=0; c<matB.vol; c++){
00061 for(long i=0; i<matA.n; i++){
00062 newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c];
00063 }
00064 }
00065
00066 return _(newmat);
00067 }