00001 // 00002 // Copyright (C) 2002-2006 Greg Landrum and Rational Discovery LLC 00003 // 00004 // @@ All Rights Reserved @@ 00005 // 00006 // 00007 #ifndef __RD_UTILS_H__ 00008 #define __RD_UTILS_H__ 00009 00010 #include "types.h" 00011 00012 #include <boost/random.hpp> 00013 00014 namespace RDKit{ 00015 const int NUM_PRIMES_AVAIL = 1000; //!< the number of primes available and stored 00016 extern int firstThousandPrimes[NUM_PRIMES_AVAIL]; 00017 00018 const int FILE_MAXLINE=256; //!< an assumed maximum length for lines read from files 00019 00020 //! \brief compute the product of the set of primes corresponding to the 00021 //! values in an INT_VECT 00022 double computeIntVectPrimesProduct(const INT_VECT &ring); 00023 00024 //! floating point comparison with a tolerance 00025 bool feq(double v1,double v2,double tol=1e-4); 00026 00027 typedef boost::minstd_rand rng_type; 00028 typedef boost::uniform_int<> uniform_int; 00029 typedef boost::uniform_real<> uniform_double; 00030 typedef boost::variate_generator<rng_type &,uniform_int> int_source_type; 00031 typedef boost::variate_generator<rng_type &,uniform_double> double_source_type; 00032 00033 //! Optionally seed and return a reference to the global (Boost) random generator 00034 rng_type &getRandomGenerator(int seed=-1); 00035 00036 //! Return a random double value between 0.0 and 1.0 00037 //! Optionally seed the random number generator 00038 double getRandomVal(int seed = -1); 00039 00040 } 00041 00042 00043 00044 #endif
1.5.3