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