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