CPPLapack
 All Classes Files Functions Variables Friends
_zhsmatrix-_zhsmatrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! _zhsmatrix+_zhsmatrix operator */
00003 inline _zhsmatrix operator+(const _zhsmatrix& matA, const _zhsmatrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(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 << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   zhsmatrix newmat(matA);
00015   
00016   for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
00017     newmat(it->i,it->j) +=it->v;
00018   }
00019   
00020   matB.destroy();
00021   return _(newmat);
00022 }
00023 
00024 //=============================================================================
00025 /*! _zhsmatrix-_zhsmatrix operator */
00026 inline _zhsmatrix operator-(const _zhsmatrix& matA, const _zhsmatrix& matB)
00027 {VERBOSE_REPORT;
00028 #ifdef  CPPL_DEBUG
00029   if(matA.n!=matB.n){
00030     ERROR_REPORT;
00031     std::cerr << "These two matrises can not make a subtraction." << std::endl
00032               << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
00033     exit(1);
00034   }
00035 #endif//CPPL_DEBUG
00036   
00037   zhsmatrix newmat(matA);
00038   
00039   for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
00040     newmat(it->i,it->j) -=it->v;
00041   }
00042   
00043   matB.destroy();
00044   return _(newmat);
00045 }
00046 
00047 //=============================================================================
00048 /*! _zhsmatrix*_zhsmatrix operator */
00049 /*
00050 inline _zhsmatrix operator*(const _zhsmatrix& matA, const _zhsmatrix& matB)
00051 {VERBOSE_REPORT;
00052 #ifdef  CPPL_DEBUG
00053   if(matA.n!=matB.n){
00054     ERROR_REPORT;
00055     std::cerr << "These two matrises can not make a product." << std::endl
00056               << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
00057     exit(1);
00058   }
00059 #endif//CPPL_DEBUG
00060   
00061   zhsmatrix newmat(matA.n);
00062   
00063   for(long c=0; c<matA.vol; c++){
00064     long k(matA.jndx[c]);
00065     std::vector< std::pair<long,long> >::iterator p;
00066     for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){
00067       newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second];
00068     }
00069   }
00070   
00071   matA.destroy();
00072   matB.destroy();
00073   return _(newmat);
00074 }
00075 */
 All Classes Files Functions Variables Friends