11#ifndef __RD_BITOPS_H__
12#define __RD_BITOPS_H__
32 double (*metric)(
const T &,
const T &),
33 bool returnDistance =
false) {
35 if (bv1.getNumBits() > bv2.getNumBits()) {
37 res = metric(*bv1tmp, bv2);
39 }
else if (bv2.getNumBits() > bv1.getNumBits()) {
41 res = metric(bv1, *bv2tmp);
44 res = metric(bv1, bv2);
54 double (*metric)(
const T &,
const T &,
double,
double),
55 bool returnDistance =
false) {
57 if (bv1.getNumBits() > bv2.getNumBits()) {
59 res = metric(*bv1tmp, bv2, a, b);
61 }
else if (bv2.getNumBits() > bv1.getNumBits()) {
63 res = metric(bv1, *bv2tmp, a, b);
66 res = metric(bv1, bv2, a, b);
77 const std::string &ref);
83 const std::string &pkl);
92template <
typename T1,
typename T2>
102template <
typename T1,
typename T2>
110template <
typename T1,
typename T2>
117template <
typename T1,
typename T2>
125template <
typename T1,
typename T2>
138template <
typename T1,
typename T2>
146template <
typename T1,
typename T2>
154template <
typename T1,
typename T2>
162template <
typename T1,
typename T2>
170template <
typename T1,
typename T2>
182template <
typename T1,
typename T2>
190template <
typename T1,
typename T2>
198template <
typename T1,
typename T2>
205template <
typename T1,
typename T2>
216template <
typename T1,
typename T2>
221template <
typename T1,
typename T2>
226template <
typename T1,
typename T2>
235template <
typename T1,
typename T2>
248template <
typename T1,
typename T2>
262template <
typename T1>
264 unsigned int factor = 2);
273template <
typename T1>
284template <
typename T1>
294template <
typename T1>
304template <
typename T1>
306 const std::string &fps);
316template <
typename T1>
318 T1 &bv1,
const std::string &fps);
323 const unsigned char *bv1,
unsigned int nBytes);
326 const unsigned char *bv2,
327 unsigned int nBytes);
329 const unsigned char *bv2,
330 unsigned int nBytes);
332 const unsigned char *bv2,
334 double ca,
double cb);
336 const unsigned char *probe,
const unsigned char *ref,
unsigned int nBytes);
RDKIT_DATASTRUCTS_EXPORT std::string BitVectToBinaryText(const T1 &bv1)
returns a binary string representation of a bit vector (an array of bytes)
RDKIT_DATASTRUCTS_EXPORT double McConnaugheySimilarity(const T1 &bv1, const T2 &bv2)
returns the McConnaughey similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT int NumBitsInCommon(const T1 &bv1, const T2 &bv2)
returns the number of common bits (on and off) between two bit vects
RDKIT_DATASTRUCTS_EXPORT double AsymmetricSimilarity(const T1 &bv1, const T2 &bv2)
returns the Asymmetric similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT bool AllProbeBitsMatch(const char *probe, const char *ref)
RDKIT_DATASTRUCTS_EXPORT unsigned int CalcBitmapPopcount(const unsigned char *bv1, unsigned int nBytes)
double SimilarityWrapper(const T &bv1, const T &bv2, double(*metric)(const T &, const T &), bool returnDistance=false)
RDKIT_DATASTRUCTS_EXPORT std::string BitVectToFPSText(const T1 &bv1)
RDKIT_DATASTRUCTS_EXPORT double TverskySimilarity(const T1 &bv1, const T2 &bv2, double a, double b)
returns the Tversky similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double RusselSimilarity(const T1 &bv1, const T2 &bv2)
returns the Russel similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double AllBitSimilarity(const T1 &bv1, const T2 &bv2)
RDKIT_DATASTRUCTS_EXPORT std::string BitVectToText(const T1 &bv1)
returns a text representation of a bit vector (a string of 0s and 1s)
RDKIT_DATASTRUCTS_EXPORT double BraunBlanquetSimilarity(const T1 &bv1, const T2 &bv2)
returns the Braun-Blanquet similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double OnBitSimilarity(const T1 &bv1, const T2 &bv2)
returns the on bit similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT bool CalcBitmapAllProbeBitsMatch(const unsigned char *probe, const unsigned char *ref, unsigned int nBytes)
RDKIT_DATASTRUCTS_EXPORT IntVect OnBitsInCommon(const T1 &bv1, const T2 &bv2)
RDKIT_DATASTRUCTS_EXPORT T1 * FoldFingerprint(const T1 &bv1, unsigned int factor=2)
folds a bit vector factor times and returns the result
RDKIT_DATASTRUCTS_EXPORT double SokalSimilarity(const T1 &bv1, const T2 &bv2)
returns the Sokal similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double CosineSimilarity(const T1 &bv1, const T2 &bv2)
returns the Cosine similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double DiceSimilarity(const T1 &bv1, const T2 &bv2)
returns the Dice similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double KulczynskiSimilarity(const T1 &bv1, const T2 &bv2)
returns the Kulczynski similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT double RogotGoldbergSimilarity(const T1 &bv1, const T2 &bv2)
returns the Rogot-Goldberg similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT IntVect OffBitsInCommon(const T1 &bv1, const T2 &bv2)
RDKIT_DATASTRUCTS_EXPORT double CalcBitmapDice(const unsigned char *bv1, const unsigned char *bv2, unsigned int nBytes)
RDKIT_DATASTRUCTS_EXPORT double TanimotoSimilarity(const T1 &bv1, const T2 &bv2)
returns the Tanimoto similarity between two bit vects
RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromBinaryText(T1 &bv1, const std::string &fps)
RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTversky(const unsigned char *bv1, const unsigned char *bv2, unsigned int nBytes, double ca, double cb)
RDKIT_DATASTRUCTS_EXPORT void UpdateBitVectFromFPSText(T1 &bv1, const std::string &fps)
updates a bit vector from Andrew Dalke's FPS format
RDKIT_DATASTRUCTS_EXPORT double CalcBitmapTanimoto(const unsigned char *bv1, const unsigned char *bv2, unsigned int nBytes)
RDKIT_DATASTRUCTS_EXPORT DoubleVect OffBitProjSimilarity(const T1 &bv1, const T2 &bv2)
returns the on-bit projected similarities between two bit vects
RDKIT_DATASTRUCTS_EXPORT int NumOnBitsInCommon(const T1 &bv1, const T2 &bv2)
returns the number of on bits in common between two bit vectors
RDKIT_DATASTRUCTS_EXPORT DoubleVect OnBitProjSimilarity(const T1 &bv1, const T2 &bv2)
returns the on-bit projected similarities between two bit vects
std::vector< int > IntVect
std::vector< double > DoubleVect
Pulls in all the BitVect classes.
a class for bit vectors that are densely occupied
#define RDKIT_DATASTRUCTS_EXPORT