IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
Embedding.h
Go to the documentation of this file.
1/**
2 * \file IMP/statistics/Embedding.h
3 * \brief Cluster sets of points.
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPSTATISTICS_EMBEDDING_H
10#define IMPSTATISTICS_EMBEDDING_H
11
12#include <IMP/statistics/statistics_config.h>
13#include <IMP/algebra/VectorD.h>
14#include <IMP/Object.h>
15#include <IMP/object_macros.h>
16
17IMPSTATISTICS_BEGIN_NAMESPACE
18
19//! Store data to be clustered for embedding based algorithms.
20/** Point-based clustering needs a way of embedding the data being clustered
21 in space. Classes which implement Embedding provide a
22 mapping between each item being clustered (named by an integer index)
23 and a point in space, as a fixed-length array of floating point numbers.
24 */
25class IMPSTATISTICSEXPORT Embedding : public IMP::Object {
26 protected:
27 Embedding(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 algebra::VectorKD get_point(unsigned int i) const = 0;
36 virtual unsigned int get_number_of_items() const = 0;
37 //! Return a weight for the point.
38 double get_weight(unsigned int i) const { return do_get_weight(i); }
39 virtual algebra::VectorKDs get_points() const {
40 algebra::VectorKDs ret(get_number_of_items());
41 for (unsigned int i = 0; i < ret.size(); ++i) {
42 ret[i] = get_point(i);
43 }
44 return ret;
45 }
46};
47
49
50IMPSTATISTICS_END_NAMESPACE
51
52#endif /* IMPSTATISTICS_EMBEDDING_H */
A shared base class to help in debugging and things.
Simple D vector class.
Common base class for heavy weight IMP objects.
Definition Object.h:111
Store data to be clustered for embedding based algorithms.
Definition Embedding.h:25
double get_weight(unsigned int i) const
Return a weight for the point.
Definition Embedding.h:38
virtual double do_get_weight(unsigned int i) const
By default return 1.0.
Definition Embedding.h:29
IMP::Vector< IMP::Pointer< Embedding > > Embeddings
Definition Embedding.h:48
Vector< VectorD<-1 > > VectorKDs
Definition VectorD.h:425
VectorD<-1 > VectorKD
Definition VectorD.h:423
Helper macros for implementing IMP Objects.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_UNUSED(variable)