RDKit
Open-source cheminformatics and machine learning.
DistPicker.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2003-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef _RD_DISTPICKER_H
11 #define _RD_DISTPICKER_H
12 
13 #include <RDGeneral/types.h>
14 
15 namespace RDPickers {
16 
17 /*! \brief function to lookup distance from 1D lower triangular distance matrix
18  *
19  *
20  * \param distMat - a pointer to a 1D lower triangular distance matrix \n
21  * \param i - row index \n
22  * \param j - column index \n
23  *
24  * RETURNS:
25  *
26  * if (i == j) : 0.0
27  * if (i > j) : distMat[i*(i-1)/2 + j]
28  * if (j < i) : distMat[j*(j-1)/2 + i]
29  */
30 double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j);
31 
32 /*! \brief Abstract base class to do perform item picking (typically molecules)
33  *using a
34  * distance matrix
35  *
36  * This class should never be instantiated by itself. One of the child classes
37  *need to be
38  * used. The picking algorithm itself is missing here and only the child
39  *calsses implement that
40  * This class contains a pointer to a distance matrix, but it is not
41  *responsible for cleaning it up
42  */
43 class DistPicker {
44  public:
45  /*! \brief Default constructor
46  *
47  */
49  virtual ~DistPicker(){};
50 
51  /*! \brief this is a virtual function specific to the type of algorihtm used
52  *
53  * The child classes need to implement this function
54  *
55  * ARGUMENTS:
56  *
57  * \param distMat - distance matrix - a vector of double. It is assumed
58  *that only the
59  * lower triangle elements of the matrix are supplied in a 1D
60  *array
61  * \param poolSize - the size of teh pool to pick the items from. It is
62  *assumed that the
63  * distance matrix above contains the right number of elements;
64  *i.e.
65  * poolSize*(poolSize-1)
66  * \param pickSize - the number items to pick from pool (<= poolSize)
67  *
68  * \return a vector with indices of the picked items.
69  */
70  virtual RDKit::INT_VECT pick(const double *distMat, unsigned int poolSize,
71  unsigned int pickSize) const = 0;
72 };
73 };
74 
75 #endif
virtual ~DistPicker()
Definition: DistPicker.h:49
virtual RDKit::INT_VECT pick(const double *distMat, unsigned int poolSize, unsigned int pickSize) const =0
this is a virtual function specific to the type of algorihtm used
double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j)
function to lookup distance from 1D lower triangular distance matrix
std::vector< int > INT_VECT
Definition: types.h:191
Abstract base class to do perform item picking (typically molecules) using a distance matrix...
Definition: DistPicker.h:43
DistPicker()
Default constructor.
Definition: DistPicker.h:48