RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDDataManip::MetricMatrixCalc< vectType, entryType > Class Template Reference

A generic metric matrix calculator (e.g similarity matrix or distance matrix) More...

#include <MetricMatrixCalc.h>

Public Member Functions

 MetricMatrixCalc ()
 Default Constructor.
 
void setMetricFunc (double(*mFunc)(const entryType &, const entryType &, unsigned int))
 Set the metric function.
 
void calcMetricMatrix (const vectType &descripts, unsigned int nItems, unsigned int dim, double *distMat)
 The calculator function.
 

Detailed Description

template<class vectType, class entryType>
class RDDataManip::MetricMatrixCalc< vectType, entryType >

A generic metric matrix calculator (e.g similarity matrix or distance matrix)

This templated class needs some explanation vectType is a container that can support [] operator entryType is the type of entry that is returned by the [] operator Examples of the container include PySequenceHolder which is wrapper around a python sequence objects like lists and tuples. Examples of the entryType include a sequence of double, floats, and ExplicitBitVects

Definition at line 33 of file MetricMatrixCalc.h.

Constructor & Destructor Documentation

◆ MetricMatrixCalc()

template<class vectType , class entryType >
RDDataManip::MetricMatrixCalc< vectType, entryType >::MetricMatrixCalc ( )
inline

Default Constructor.

Definition at line 38 of file MetricMatrixCalc.h.

Member Function Documentation

◆ calcMetricMatrix()

template<class vectType , class entryType >
void RDDataManip::MetricMatrixCalc< vectType, entryType >::calcMetricMatrix ( const vectType & descripts,
unsigned int nItems,
unsigned int dim,
double * distMat )
inline

The calculator function.

ARGUMENTS:

descrips - vectType container with a entryType for each item nItems - the number of item in the descripts. In several cases this argument is irrelvant since vectType probably supports a size() member function, But we would like this interface to take for example a double** and correctly parse the row and columns. dim - the dimension of the sequences distMat - pointer to an array to write the distance matrix to it is assumed that the right sized array has already be allocated.

FIX: we can probably make this function create the correct sized distMat and return it to the caller, but when pushing he result out to a python array not sure how to avoid copy the entire distance matrix in that case

RETURNS:

pointer to a 1D array of doubles. Only the lower triangle elements are included in the array

Definition at line 80 of file MetricMatrixCalc.h.

References CHECK_INVARIANT.

◆ setMetricFunc()

template<class vectType , class entryType >
void RDDataManip::MetricMatrixCalc< vectType, entryType >::setMetricFunc ( double(*)(const entryType &, const entryType &, unsigned int) mFunc)
inline

Set the metric function.

Set the pointer to the mertic funvtion to be used by the metric calculator

ARGUMENTS:

mFunc - pointer to the metric function

Definition at line 48 of file MetricMatrixCalc.h.


The documentation for this class was generated from the following file: