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