On Sat, Apr 18, 2009 at 10:50 AM, John Maddock wrote:
Well, what is the rationale behind the choice of this separation?
We haven't had time to provide it yet :-(
Do you think would be useful to provide this kind of integration?
Yes for sure.
Cool!
Time is short also for me.
However maybe I can help you in writing it
Note:
I'm not an expert in metaprogramming, neither in boost library; so I
don't want to become a bottleneck for library release.
A possible solution might be:
--- [snip] ---
template
T rand(G& rng, const boost::math::exponential_distribution& dist)
{
typedef typename boost::exponential_distribution<T> rdist_type;
typedef typename boost::variate_generator variate_type;
return variate_type(rng, rdist_type(dist.lambda()))();
}
--- [/snip] ---
This is not the *best* solution since each time rand is called a
temporary boost::variate_generator and boost::exponential_distribution
objects are created.
Another possible solution is to copy the code from the
math/random/*.hpp classes although this duplication is not so good.
Further in some case we have to move the implemention inside the
(math::) distribution for keeping a kind of state (e.g., the normal
variate generation include the generation of two uniform numbers at
time) and the call this method from the rand function, like this
below:
--- [snip] ---
template
T rand(G& rng, const boost::math::normal_distribution& dist)
{
return dist.rand(rng);
}
--- [/snip] ---
Let me know.
-- Marco
HTH, John.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users