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) using a
33  * distance matrix
34  *
35  * This class should never be instantiated by itself. One of the child classes need to be
36  * used. The picking algorithm itself is missing here and only the child calsses implement that
37  * This class contains a pointer to a distance matrix, but it is not responsible for cleaning it up
38  */
39  class DistPicker {
40 
41  public:
42  /*! \brief Default constructor
43  *
44  */
46  virtual ~DistPicker() {};
47 
48  /*! \brief this is a virtual function specific to the type of algorihtm used
49  *
50  * The child classes need to implement this function
51  *
52  * ARGUMENTS:
53  *
54  * \param distMat - distance matrix - a vector of double. It is assumed that only the
55  * lower triangle elements of the matrix are supplied in a 1D array
56  * \param poolSize - the size of teh pool to pick the items from. It is assumed that the
57  * distance matrix above contains the right number of elements; i.e.
58  * poolSize*(poolSize-1)
59  * \param pickSize - the number items to pick from pool (<= poolSize)
60  *
61  * \return a vector with indices of the picked items.
62  */
63  virtual RDKit::INT_VECT pick(const double *distMat, unsigned int poolSize,
64  unsigned int pickSize) const = 0;
65  };
66 };
67 
68 #endif
virtual ~DistPicker()
Definition: DistPicker.h:46
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:146
Abstract base class to do perform item picking (typically molecules) using a distance matrix...
Definition: DistPicker.h:39
DistPicker()
Default constructor.
Definition: DistPicker.h:45