Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ClusterRep.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2002 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010 */
00011 /*
00012   Author: dmf 11/2002
00013  */
00014 
00015 #ifndef _CLUSTERREP_HPP
00016 #define _CLUSTERREP_HPP
00017 #include "common_headers.hpp"
00018 #include "FloatFreqVector.hpp"
00019 #include "Index.hpp"
00021 class ClusterRep {
00022 public:
00024   ClusterRep(const Index &ind) : index(ind) {
00025     rep = new FloatFreqVector();
00026   }
00028   ClusterRep(DOCID_T did, const Index &ind);
00030   ClusterRep(TermInfoList *tList, const Index &ind);
00032   ClusterRep(vector<DOCID_T> &dids, const Index &ind);
00034   ClusterRep(FloatFreqVector *v, const Index &ind);
00036   ClusterRep(const ClusterRep *old);
00038   virtual ~ClusterRep();  
00041   virtual void normalize();
00043   double sum2() const {return rep->sum2();}
00045   FloatFreqVector *getRep() const {return rep;}
00048   void weigh(const double *vals){rep->weigh(vals);} 
00051   void weigh(double val){rep->weigh(val);} 
00054   void addVal(int id, double val) {rep->addVal(id, val);}  
00057   void addTerms(const vector<TERMID_T> &tids) {
00058     for (int i = 0; i < tids.size(); i++) {
00059       addVal(tids[i], 1);
00060     }
00061   }
00064   void addVec(const ClusterRep *v2){rep->addVec(v2->rep);}
00067   void subtract(const ClusterRep *v2){rep->subtract(v2->rep);}
00069   double dotProd(const ClusterRep *v2) const {return rep->dotProd(v2->rep);}
00070 
00071 private:
00072   FloatFreqVector *rep;
00073   const Index &index;
00074 };
00075 
00076 #endif /* _CLUSTERREP_HPP */

Generated on Wed Nov 3 12:58:52 2004 for Lemur Toolkit by doxygen1.2.18