IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
PartitionalClustering.h
Go to the documentation of this file.
1 /**
2  * \file IMP/statistics/PartitionalClustering.h
3  * \brief Compute a distance metric between two points
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSTATISTICS_PARTITIONAL_CLUSTERING_H
10 #define IMPSTATISTICS_PARTITIONAL_CLUSTERING_H
11 
12 #include <IMP/statistics/statistics_config.h>
13 #include <IMP/macros.h>
14 #include <IMP/base_types.h>
15 #include <IMP/Object.h>
16 
17 IMPSTATISTICS_BEGIN_NAMESPACE
18 
19 //! A base class for clustering results where each item is in one cluster
20 /** Data items are represented by an index. In a partitional clustering
21  each item can only be contained in one cluster. The indexes used refer
22  to the index used in the Metric or Embedding used to generate the
23  clustering.
24 */
25 class IMPSTATISTICSEXPORT PartitionalClustering : public IMP::Object {
26  public:
27  PartitionalClustering(std::string name) : Object(name) {}
28  virtual unsigned int get_number_of_clusters() const = 0;
29  //! Return the list of indexes in the ith cluster.
30  virtual const Ints& get_cluster(unsigned int cluster_index) const = 0;
31  //! Return the index of an item that "typifies" the ith cluster.
32  virtual int get_cluster_representative(unsigned int cluster_index) const = 0;
34 };
35 
36 //! Check that the clustering is a valid clustering of n elements.
37 /** An exception is thrown if it is not, if the build is not a fast build. */
38 IMPSTATISTICSEXPORT void validate_partitional_clustering(
39  PartitionalClustering* pc, unsigned int n);
40 
41 IMPSTATISTICS_END_NAMESPACE
42 #endif /* IMPSTATISTICS_PARTITIONAL_CLUSTERING_H */
Basic types used by IMP.
void validate_partitional_clustering(PartitionalClustering *pc, unsigned int n)
Check that the clustering is a valid clustering of n elements.
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Definition: Object.h:111
A shared base class to help in debugging and things.
Object(std::string name)
Construct an object with the given name.
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
A base class for clustering results where each item is in one cluster.