 |
RDKit
Open-source cheminformatics and machine learning.
|
Go to the documentation of this file.
12 #ifndef __RD_UTILS_H__
13 #define __RD_UTILS_H__
18 #define BOOST_ALLOW_DEPRECATED_HEADERS
19 #include <boost/random.hpp>
20 #undef BOOST_ALLOW_DEPRECATED_HEADERS
57 PRECONDITION(ref.size() == probe.size(),
"size mismatch");
58 typename T::const_iterator refIt = ref.begin();
59 typename T::iterator probeIt = probe.begin();
60 typename T::iterator probeIt2;
62 unsigned int nSwaps = 0;
63 while (refIt != ref.end()) {
64 if ((*probeIt) != (*refIt)) {
67 while ((*probeIt2) != (*refIt) && probeIt2 != probe.end()) {
70 if (probeIt2 != probe.end()) {
75 std::swap(*probeIt, *probeIt2);
88 double half =
int_pow<n / 2>(x);
92 return half * half * x;
std::vector< int > INT_VECT
RDKIT_RDGENERAL_EXPORT bool feq(double v1, double v2, double tol=1e-4)
floating point comparison with a tolerance
const int NUM_PRIMES_AVAIL
the number of primes available and stored
int firstThousandPrimes[NUM_PRIMES_AVAIL]
RDKIT_RDGENERAL_EXPORT double getRandomVal(int seed=-1)
boost::minstd_rand rng_type
boost::variate_generator< rng_type &, uniform_int > int_source_type
#define CHECK_INVARIANT(expr, mess)
RDKIT_RDGENERAL_EXPORT double_source_type & getDoubleRandomSource()
return a reference to the global (Boost) random source
double int_pow< 0 >(double)
boost::uniform_real uniform_double
boost::uniform_int uniform_int
double int_pow< 1 >(double x)
RDKIT_RDGENERAL_EXPORT rng_type & getRandomGenerator(int seed=-1)
Optionally seed and return a reference to the global (Boost) random.
#define PRECONDITION(expr, mess)
unsigned int countSwapsToInterconvert(const T &ref, T probe)
boost::variate_generator< rng_type &, uniform_double > double_source_type
RDKIT_RDGENERAL_EXPORT double computeIntVectPrimesProduct(const INT_VECT &ring)
compute the product of the set of primes corresponding to the values in an INT_VECT
#define RDKIT_RDGENERAL_EXPORT
const int FILE_MAXLINE
an assumed maximum length for lines read from files