int findTheDot(QueryMap q_obj, DocMap w) { int dot=0; for (QueryMap::iterator l=q_obj.begin(); l != q_obj.end(); ++l) for (DocMap::iterator p = w.begin(); p != w.end(); ++p) if (l->first == p->first) dot+=dotprod(l->second, p->second); return dot; }
void DocSet::produceClusters(DocSet::ClusterMap& outClusters) { for (DocMap::iterator it = docMap_.begin(); it != docMap_.end(); ++it) { Doc* rep = it->second->findRep(); outClusters[rep].push_back(it->first); } }
float Doc_mod(DocMap w) { float store=0; for (DocMap::iterator p = w.begin(); p != w.end(); ++p) store+=(p->second*p->second); return sqrt(store); }