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
#include <
RDGeneral/export.h
>
11
#ifndef _RD_DISTPICKER_H
12
#define _RD_DISTPICKER_H
13
14
#include <
RDGeneral/types.h
>
15
16
namespace
RDPickers
{
17
18
/*! \brief function to lookup distance from 1D lower triangular distance matrix
19
*
20
*
21
* \param distMat - a pointer to a 1D lower triangular distance matrix \n
22
* \param i - row index \n
23
* \param j - column index \n
24
*
25
* RETURNS:
26
*
27
* if (i == j) : 0.0
28
* if (i > j) : distMat[i*(i-1)/2 + j]
29
* if (j < i) : distMat[j*(j-1)/2 + i]
30
*/
31
RDKIT_SIMDIVPICKERS_EXPORT
double
getDistFromLTM
(
const
double
*distMat,
32
unsigned
int
i,
33
unsigned
int
j);
34
35
/*! \brief Abstract base class to do perform item picking (typically molecules)
36
*using a
37
* distance matrix
38
*
39
* This class should never be instantiated by itself. One of the child classes
40
*need to be
41
* used. The picking algorithm itself is missing here and only the child
42
*calsses implement that
43
* This class contains a pointer to a distance matrix, but it is not
44
*responsible for cleaning it up
45
*/
46
class
RDKIT_SIMDIVPICKERS_EXPORT
DistPicker
{
47
public
:
48
/*! \brief Default constructor
49
*
50
*/
51
DistPicker
(){};
52
virtual
~DistPicker
(){};
53
54
/*! \brief this is a virtual function specific to the type of algorihtm used
55
*
56
* The child classes need to implement this function
57
*
58
* ARGUMENTS:
59
*
60
* \param distMat - distance matrix - a vector of double. It is assumed
61
*that only the
62
* lower triangle elements of the matrix are supplied in a 1D
63
*array
64
* \param poolSize - the size of teh pool to pick the items from. It is
65
*assumed that the
66
* distance matrix above contains the right number of elements;
67
*i.e.
68
* poolSize*(poolSize-1)
69
* \param pickSize - the number items to pick from pool (<= poolSize)
70
*
71
* \return a vector with indices of the picked items.
72
*/
73
virtual
RDKit::INT_VECT
pick(
const
double
*distMat,
unsigned
int
poolSize,
74
unsigned
int
pickSize)
const
= 0;
75
};
76
77
namespace
{
78
class
RDKIT_SIMDIVPICKERS_EXPORT
distmatFunctor {
79
public
:
80
distmatFunctor(
const
double
*distMat) : dp_distMat(distMat){};
81
double
operator()(
unsigned
int
i,
unsigned
int
j) {
82
return
getDistFromLTM
(this->dp_distMat, i, j);
83
}
84
85
private
:
86
const
double
*dp_distMat;
87
};
88
}
// namespace
89
90
};
// namespace RDPickers
91
92
#endif
RDPickers::DistPicker::~DistPicker
virtual ~DistPicker()
Definition:
DistPicker.h:52
RDKit::INT_VECT
std::vector< int > INT_VECT
Definition:
types.h:254
types.h
RDKIT_SIMDIVPICKERS_EXPORT
#define RDKIT_SIMDIVPICKERS_EXPORT
Definition:
export.h:619
RDPickers::getDistFromLTM
RDKIT_SIMDIVPICKERS_EXPORT double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j)
function to lookup distance from 1D lower triangular distance matrix
RDPickers::DistPicker
Abstract base class to do perform item picking (typically molecules) using a distance matrix.
Definition:
DistPicker.h:46
RDPickers
Definition:
DistPicker.h:16
RDPickers::DistPicker::DistPicker
DistPicker()
Default constructor.
Definition:
DistPicker.h:51
export.h
SimDivPickers
DistPicker.h
Generated on Fri Jun 12 2020 19:04:45 for RDKit by
1.8.17