//=============================================================================
/*! dssmatrix*dcovector operator */
inline _dcovector operator*(const dssmatrix& mat, const dcovector& vec)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const dssmatrix&, const dcovector&)" << std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(mat.N!=vec.L){
std::cerr << "[ERROR] operator*(const dssmatrix&, const dcovector&)" << std::endl
<< "These matrix and vector can not make a product." << std::endl
<< "Your input was (" << mat.N << "x" << mat.N << ") * (" << vec.L << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dcovector newvec(mat.N);
newvec.zero();
for(std::vector<dcomponent>::const_iterator it=mat.Data.begin(); it!=mat.Data.end(); it++){
newvec(it->i) +=it->v*vec(it->j);
if(it->i!=it->j){
newvec(it->j) +=it->v*vec(it->i);
}
}
return _(newvec);
}