CPPLapack
 All Classes Files Functions Variables Friends
_dgematrix-dssmatrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! _dgematrix*dssmatrix operator */
00003 inline _dgematrix operator*(const _dgematrix& matA, const dssmatrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(matA.n!=matB.m){
00007     ERROR_REPORT;
00008     std::cerr << "These two matrises can not make a product." << 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   dgematrix newmat(matA.m, matB.n);
00015   newmat.zero();
00016   
00017   for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
00018     for(long i=0; i<matA.m; i++){
00019       newmat(i,it->j) +=matA(i,it->i)*it->v;
00020     }
00021     if(it->i!=it->j){
00022       for(long i=0; i<matA.m; i++){
00023         newmat(i,it->i) +=matA(i,it->j)*it->v;
00024       }
00025     }
00026   }
00027   
00028   matA.destroy();
00029   return _(newmat);
00030 }
 All Classes Files Functions Variables Friends