Boost logo

Boost Users :

Subject: [Boost-users] [Math/Statistical Distributions+Random] Random number generation
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-04-17 12:17:49


Hi all!

I'm a "boost newbie" so sorry for too trivial questions.

Just trying to use boost for some statistical experiments, involving
statistical distribution fitting, quantile generation (for
goodness-of-fit tests), random variate generation, and so on.
.
The "Math/Statistical Distribution" library is great and almost complete.

But I'm just curious why the random number generation (provided by the
"Random" lib) and this library have not been integrated.
For instance, the boost::random::exponential_distribution and the
boost::math::exponential_distribution are two different worlds.

I think a function like this below would be very helpful:
--- [snip] ---
template <typename Generator, typename RealType, typename Policy>
inline RealType rand(Generator& rng, const
exponential_distribution<RealType, Policy>& dist)
{
  return -1.0 / dist.lambda() * std::log(1.0-rng());
}
--- [snip] ---
or something similar (e.g., rand implemented as a class method)
In this case only two objects are needed:
* boost::random::mersenne_twister
* boost::math::exponential_distribution

Instead, actually I have to keep different objects. For instance, for
the exponential distribution:
* boost::random::exponential_distribution
* boost::random::mersenne_twister
* boost::random::variate_generator
* boost::math::exponential_distribution
Unluckely I can't use boost::math::exponential_distribution in place
of boost::random::exponential_distribution since
boost::random::variate_generator expects a specific interface for the
distribution.

Well, what is the rationale behind the choice of this separation?
Do you think would be useful to provide this kind of integration?

Thank you very much in advance!!

Cheers

-- Marco


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net