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