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