IMP logo
IMP Reference Guide  2.10.0
The Integrative Modeling Platform
Metric.h
Go to the documentation of this file.
1 /**
2  * \file IMP/statistics/Metric.h
3  * \brief Cluster sets of points.
4  *
5  * Copyright 2007-2018 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSTATISTICS_METRIC_H
10 #define IMPSTATISTICS_METRIC_H
11 
12 #include <IMP/statistics/statistics_config.h>
13 #include <IMP/Object.h>
14 #include <IMP/object_macros.h>
15 #include <IMP/ref_counted_macros.h>
16 
17 IMPSTATISTICS_BEGIN_NAMESPACE
18 
19 //! Store data to be clustered for distance metric based algorithms
20 /** Metric clustering needs a way of computing the
21  distances between the things being clustered. Classes that
22  implement this abstract base class provide a way of getting the
23  distance between any two items.
24  */
25 class IMPSTATISTICSEXPORT Metric : public IMP::Object {
26  protected:
27  Metric(std::string name);
28  //! By default return 1.0
29  virtual double do_get_weight(unsigned int i) const {
30  IMP_UNUSED(i);
31  return 1.0;
32  }
33 
34  public:
35  virtual double get_distance(unsigned int i, unsigned int j) const = 0;
36  //! Return a weight for the point.
37  double get_weight(unsigned int i) const { return do_get_weight(i); }
38  virtual unsigned int get_number_of_items() const = 0;
40 };
41 
43 
44 IMPSTATISTICS_END_NAMESPACE
45 
46 #endif /* IMPSTATISTICS_METRIC_H */
Various general useful macros for IMP.
Various general useful macros for IMP.
A more IMP-like version of the std::vector.
Definition: Vector.h:39
virtual double do_get_weight(unsigned int i) const
By default return 1.0.
Definition: Metric.h:29
double get_weight(unsigned int i) const
Return a weight for the point.
Definition: Metric.h:37
Common base class for heavy weight IMP objects.
Definition: Object.h:106
#define IMP_UNUSED(variable)
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
A shared base class to help in debugging and things.
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.
Store data to be clustered for distance metric based algorithms.
Definition: Metric.h:25