10 #ifndef __RD_BITOPS_H__ 11 #define __RD_BITOPS_H__ 31 double (*metric)(
const T &,
const T &),
32 bool returnDistance=
false){
34 if(bv1.getNumBits()>bv2.getNumBits()){
36 res = metric(*bv1tmp,bv2);
38 }
else if(bv2.getNumBits()>bv1.getNumBits()){
40 res = metric(bv1,*bv2tmp);
43 res = metric(bv1,bv2);
45 if(returnDistance) res = 1.0-res;
51 double (*metric)(
const T &,
const T &,
double,
double),
52 bool returnDistance=
false){
54 if(bv1.getNumBits()>bv2.getNumBits()){
56 res = metric(*bv1tmp,bv2,a,b);
58 }
else if(bv2.getNumBits()>bv1.getNumBits()){
60 res = metric(bv1,*bv2tmp,a,b);
63 res = metric(bv1,bv2,a,b);
65 if(returnDistance) res = 1.0-res;
75 template <
typename T1>
78 template <
typename T1>
86 template <
typename T1,
typename T2>
97 template <
typename T1,
typename T2>
105 template <
typename T1,
typename T2>
114 template <
typename T1,
typename T2>
123 template <
typename T1,
typename T2>
138 template <
typename T1,
typename T2>
141 const T2& bv2,
double a,
double b);
147 template <
typename T1,
typename T2>
156 template <
typename T1,
typename T2>
165 template <
typename T1,
typename T2>
174 template <
typename T1,
typename T2>
187 template <
typename T1,
typename T2>
197 template <
typename T1,
typename T2>
206 template <
typename T1,
typename T2>
214 template <
typename T1,
typename T2>
226 template <
typename T1,
typename T2>
231 template <
typename T1,
typename T2>
236 template <
typename T1,
typename T2>
246 template <
typename T1,
typename T2>
259 template <
typename T1,
typename T2>
274 template <
typename T1>
285 template <
typename T1>
296 template <
typename T1>
307 template <
typename T1>
318 template <
typename T1>
329 template <
typename T1>
Pulls in all the BitVect classes.
double DiceSimilarity(const T1 &bv1, const T2 &bv2)
returns the Dice similarity between two bit vects
T1 * FoldFingerprint(const T1 &bv1, unsigned int factor=2)
folds a bit vector factor times and returns the result
std::string BitVectToFPSText(const T1 &bv1)
returns a hex representation of a bit vector compatible with Andrew Dalke's FPS format ...
double SokalSimilarity(const T1 &bv1, const T2 &bv2)
returns the Sokal similarity between two bit vects
DoubleVect OffBitProjSimilarity(const T1 &bv1, const T2 &bv2)
returns the on-bit projected similarities between two bit vects
double TanimotoSimilarity(const T1 &bv1, const T2 &bv2)
returns the Tanimoto similarity between two bit vects
double OnBitSimilarity(const T1 &bv1, const T2 &bv2)
returns the on bit similarity between two bit vects
DoubleVect OnBitProjSimilarity(const T1 &bv1, const T2 &bv2)
returns the on-bit projected similarities between two bit vects
int NumOnBitsInCommon(const T1 &bv1, const T2 &bv2)
returns the number of on bits in common between two bit vectors
int NumBitsInCommon(const T1 &bv1, const T2 &bv2)
returns the number of common bits (on and off) between two bit vects
double RogotGoldbergSimilarity(const T1 &bv1, const T2 &bv2)
returns the Rogot-Goldberg similarity between two bit vects
void UpdateBitVectFromBinaryText(T1 &bv1, const std::string &fps)
updates a bit vector from a binary string representation of a bit vector (an array of bytes) ...
double AsymmetricSimilarity(const T1 &bv1, const T2 &bv2)
returns the Asymmetric similarity between two bit vects
std::string BitVectToBinaryText(const T1 &bv1)
returns a binary string representation of a bit vector (an array of bytes)
double CosineSimilarity(const T1 &bv1, const T2 &bv2)
returns the Cosine similarity between two bit vects
std::vector< double > DoubleVect
double SimilarityWrapper(const T &bv1, const T &bv2, double(*metric)(const T &, const T &), bool returnDistance=false)
IntVect OnBitsInCommon(const T1 &bv1, const T2 &bv2)
returns an IntVect with indices of all on bits in common between two bit vects
std::string BitVectToText(const T1 &bv1)
returns a text representation of a bit vector (a string of 0s and 1s)
double TverskySimilarity(const T1 &bv1, const T2 &bv2, double a, double b)
returns the Tversky similarity between two bit vects
double McConnaugheySimilarity(const T1 &bv1, const T2 &bv2)
returns the McConnaughey similarity between two bit vects
double AllBitSimilarity(const T1 &bv1, const T2 &bv2)
bool AllProbeBitsMatch(const char *probe, const char *ref)
std::vector< int > IntVect
a class for bit vectors that are densely occupied
IntVect OffBitsInCommon(const T1 &bv1, const T2 &bv2)
returns an IntVect with indices of all off bits in common between two bit vects
double RusselSimilarity(const T1 &bv1, const T2 &bv2)
returns the Russel similarity between two bit vects
double KulczynskiSimilarity(const T1 &bv1, const T2 &bv2)
returns the Kulczynski similarity between two bit vects
void UpdateBitVectFromFPSText(T1 &bv1, const std::string &fps)
updates a bit vector from Andrew Dalke's FPS format
double BraunBlanquetSimilarity(const T1 &bv1, const T2 &bv2)
returns the Braun-Blanquet similarity between two bit vects