00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPSTATISTICS_KM_CENTERS_H
00009 #define IMPSTATISTICS_KM_CENTERS_H
00010
00011 #include "KMData.h"
00012 IMPSTATISTICS_BEGIN_NAMESPACE
00013
00014 #ifndef IMP_DOXYGEN
00015
00016
00017
00018
00019
00020 class IMPSTATISTICSEXPORT KMCenters {
00021 public:
00022 KMCenters(){}
00023 KMCenters(int k, KMData* p);
00024 virtual ~KMCenters();
00025
00026
00027
00028
00029 KMCenters(const KMCenters &other) {
00030 data_points_ = other.data_points_;
00031 centers_ = new KMPointArray();
00032 copy_points(other.centers_,centers_);
00033 }
00034
00035 KMCenters & operator=(const KMCenters &other) {
00036 if (this != &other) {
00037 data_points_ = other.data_points_;
00038 centers_ = new KMPointArray();
00039 copy_points(other.centers_,centers_);
00040 }
00041 return *this;
00042 }
00043 int get_dim() const {
00044 return data_points_->get_dim();
00045 }
00046 int get_number_of_points() const {
00047 return data_points_->get_number_of_points();
00048 }
00049 int get_number_of_centers() const {
00050 return centers_->size();
00051 }
00052 KMData* get_data() {
00053 return data_points_;
00054 }
00055 KMPoint* operator[](int i) {
00056 return (*centers_)[i];
00057 }
00058 const KMPoint* operator[](int i) const {
00059 return (*centers_)[i];
00060 }
00061 virtual void show(std::ostream& out=std::cout) const;
00062 protected:
00063 KMData* data_points_;
00064 KMPointArray* centers_;
00065 };
00066
00067 #endif
00068
00069 IMPSTATISTICS_END_NAMESPACE
00070 #endif