CPPLapack
 All Classes Files Functions Variables Friends
drovector-dssmatrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! drovector*dssmatrix operator */
00003 inline _drovector operator*(const drovector& vec, const dssmatrix& mat)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(vec.l!=mat.n){
00007     ERROR_REPORT;
00008     std::cerr << "These vector and matrix can not make a product." << std::endl
00009               << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   drovector newvec(mat.n);
00015   newvec.zero();  
00016   for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00017     newvec(it->j) += vec(it->i)*it->v;
00018     if(it->i!=it->j){
00019       newvec(it->i) +=vec(it->j)*it->v;
00020     }
00021   }
00022   
00023   return _(newvec);
00024 }
 All Classes Files Functions Variables Friends