RDCode: DistPicker.h Source File

# DistPicker.h

Go to the documentation of this file.

    00001 //
    00002 //  Copyright (C) 2003-2006 Rational Discovery LLC
    00003 //
    00004 //   @@ All Rights Reserved  @@
    00005 //
    00006 #ifndef _RD_DISTPICKER_H
    00007 #define _RD_DISTPICKER_H
    00008
    00009 #include <RDGeneral/types.h>
    00010
    00011 namespace RDPickers {
    00012
    00013   /*! \brief function to lookup distance from 1D lower triangular distance matrix
    00014    *
    00015    *
    00016    *    \param distMat - a pointer to a 1D lower triangular distance matrix \n
    00017    *    \param i - row index \n
    00018    *    \param j - column index \n
    00019    *
    00020    *  RETURNS:
    00021    *
    00022    *    if (i == j) : 0.0
    00023    *    if (i > j) : distMat[i*(i-1)/2 + j]
    00024    *    if (j < i) : distMat[j*(j-1)/2 + i]
    00025    */
    00026   double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j);
    00027
    00028   /*! \brief Abstract base class to do perform item picking (typically molecules) using a
    00029    *         distance matrix
    00030    *
    00031    *  This class should never be instantiated by itself. One of the child classes need to be
    00032    *  used. The picking algorithm itself is missing here and only the child calsses implement that
    00033    *  This class contains a pointer to a distance matrix, but it is not responsible for cleaning it up
    00034    */
    00035   class DistPicker {
    00036
    00037   public:
    00038     /*! \brief Default constructor
    00039      *
    00040      */
    00041     DistPicker(){};
    00042     virtual ~DistPicker() {};
    00043
    00044     /*! \brief this is a virtual function specific to the type of algorihtm used
    00045      *
    00046      *  The child classes need to implement this function
    00047      *
    00048      *  ARGUMENTS:
    00049      *
    00050      *    \param distMat - distance matrix - a vector of double. It is assumed that only the
    00051      *              lower triangle elements of the matrix are supplied in a 1D array
    00052      *    \param poolSize - the size of teh pool to pick the items from. It is assumed that the
    00053      *              distance matrix above contains the right number of elements; i.e.
    00054      *              poolSize*(poolSize-1)
    00055      *    \param pickSize - the number items to pick from pool (<= poolSize)
    00056      *
    00057      *    \return a vector with indices of the picked items.
    00058      */
    00059     virtual RDKit::INT_VECT pick(const double *distMat, unsigned int poolSize,
    00060                                  unsigned int pickSize) const = 0;
    00061   };
    00062 };
    00063
    00064 #endif