IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
17IMPSTATISTICS_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*/
25class 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;
33 IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(PartitionalClustering);
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. */
38IMPSTATISTICSEXPORT void validate_partitional_clustering(
39 PartitionalClustering* pc, unsigned int n);
40
41IMPSTATISTICS_END_NAMESPACE
42#endif /* IMPSTATISTICS_PARTITIONAL_CLUSTERING_H */
A shared base class to help in debugging and things.
Basic types used by IMP.
Common base class for heavy weight IMP objects.
Definition Object.h:111
Object(std::string name)
Construct an object with the given name.
A base class for clustering results where each item is in one cluster.
virtual int get_cluster_representative(unsigned int cluster_index) const =0
Return the index of an item that "typifies" the ith cluster.
virtual const Ints & get_cluster(unsigned int cluster_index) const =0
Return the list of indexes in the ith cluster.
Various general useful macros for IMP.
void validate_partitional_clustering(PartitionalClustering *pc, unsigned int n)
Check that the clustering is a valid clustering of n elements.
IMP::Vector< Int > Ints
Standard way to pass a bunch of Int values.
Definition types.h:48
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)