mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
this builds and tests clean on linux. Windows still needs to be updated
This commit is contained in:
@@ -22,7 +22,7 @@ namespace RDInfoTheory {
|
||||
PyObject *getCorrMatrix(BitCorrMatGenerator *cmGen) {
|
||||
double *dres = cmGen->getCorrMat();
|
||||
unsigned int nb = cmGen->getCorrBitList().size();
|
||||
unsigned int dim = nb*(nb-1)/2;
|
||||
int dim = nb*(nb-1)/2;
|
||||
PyArrayObject *res = (PyArrayObject *)PyArray_FromDims(1,&dim,PyArray_DOUBLE);
|
||||
memcpy(static_cast<void *>(res->data),
|
||||
static_cast<void *>(dres), dim*sizeof(double));
|
||||
|
||||
@@ -7,4 +7,14 @@
|
||||
#include "DistPicker.h"
|
||||
|
||||
namespace RDPickers {
|
||||
double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j){
|
||||
CHECK_INVARIANT(distMat, "");
|
||||
if (i == j) {
|
||||
return 0.0;
|
||||
} else if (i > j) {
|
||||
return distMat[i*(i-1)/2 + j];
|
||||
} else {
|
||||
return distMat[j*(j-1)/2 + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,7 @@ namespace RDPickers {
|
||||
* if (i > j) : distMat[i*(i-1)/2 + j]
|
||||
* if (j < i) : distMat[j*(j-1)/2 + i]
|
||||
*/
|
||||
double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j){
|
||||
CHECK_INVARIANT(distMat, "");
|
||||
if (i == j) {
|
||||
return 0.0;
|
||||
} else if (i > j) {
|
||||
return distMat[i*(i-1)/2 + j];
|
||||
} else {
|
||||
return distMat[j*(j-1)/2 + i];
|
||||
}
|
||||
}
|
||||
double getDistFromLTM(const double *distMat, unsigned int i, unsigned int j);
|
||||
|
||||
/*! \brief Abstract base class to do perform item picking (typically molecules) using a
|
||||
* distance matrix
|
||||
@@ -48,6 +39,7 @@ namespace RDPickers {
|
||||
*
|
||||
*/
|
||||
DistPicker(){};
|
||||
virtual ~DistPicker() {};
|
||||
|
||||
/*! \brief this is a virtual function specific to the type of algorihtm used
|
||||
*
|
||||
|
||||
@@ -41,8 +41,6 @@ class TestCase(unittest.TestCase):
|
||||
clbl = labels[cl[0]]
|
||||
for id in cl:
|
||||
assert clbl == labels[id]
|
||||
|
||||
|
||||
hierarch = pkr.Pick(self.dMat, i, 2)
|
||||
assert tuple(hierarch) == (1,30)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user