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