00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPSTATISTICS_KM_CENTERS_NODE_LEAF_H
00009 #define IMPSTATISTICS_KM_CENTERS_NODE_LEAF_H
00010
00011 #include "KMCentersNode.h"
00012 #include "KMData.h"
00013 #include "KMRectangle.h"
00014 #include "IMP/log.h"
00015 IMPSTATISTICS_BEGIN_NAMESPACE
00016
00017 #ifndef IMP_DOXYGEN
00018
00019
00020
00021
00022
00023
00024
00025 class IMPSTATISTICSEXPORT KMCentersNodeLeaf: public KMCentersNode
00026 {
00027
00028 public:
00029 KMCentersNodeLeaf(){}
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 KMCentersNodeLeaf(int level,const KMRectangle &bb, KMCenters *centers,
00040 const std::vector<int> &data_inds) : KMCentersNode(bb,centers,level) {
00041 IMP_LOG(VERBOSE, "add a new center node leaf with " <<
00042 data_inds.size() << " points" <<std::endl);
00043 IMP_INTERNAL_CHECK(data_inds.size()>=1,
00044 "a leaf node should contain at least one point");
00045 for (unsigned int i=0;i<data_inds.size();i++) {
00046 data_ps_.push_back(data_inds[i]);}
00047 n_data_ = data_ps_.size();
00048 }
00049
00050
00051
00052
00053
00054
00055 void compute_sums();
00056
00057 void get_neighbors(const std::vector<int> &cands,KMPointArray *sums,
00058 KMPoint *sum_sqs,std::vector<int> *weights);
00059
00060 void get_assignments(const std::vector<int> &cands,
00061 std::vector<int> &close_center);
00062
00063
00064 KMPoint sample_center();
00065 void show(std::ostream&out=std::cout) const ;
00066 protected:
00067 std::vector<int> data_ps_;
00068
00069 };
00070
00071 #endif
00072
00073 IMPSTATISTICS_END_NAMESPACE
00074 #endif