|
Boost : |
From: Darren O'Driscoll (darren.odriscoll_at_[hidden])
Date: 2006-05-24 20:08:06
Hi all,
I'm a relatively recent discoveror of these libraries, and for the last few
weeks I've been like a kid in a toy shop as I've worked through them, and
discovered the joys of the shared_ptr,bind,lambda,function libraries, etc.
I've just arrived at the Boost.Random library, an area quite close to my
heart as I make a lot of use of random deviate generators in my work in
Financial Mathematics. I really like the set up and design of the libraries,
but I have a few suggestions for additions which might be nice to have.
Apologies in advance if these have already been discussed here, I haven't
quite got the hang of searching through old posts in an efficient way.
I hope noone's switched off during my long pre-amble, on to the meat of my
post:
1. In general I've noticed that deviates for specific distributions are
generated in one of two ways - a) according to a special algorithm, which
usually involves generating one or more uniforms and doing some optimised
transforms, or b) by generating a (0,1) uniform, and inverting the
Cumulative distribution function.
Method a), which seems to have been stuck to in Boost.Random is generally
the more efficient of the two methods, but there are a number of cases where
b) is necessary, specifically when using low-discrepancy sequences such as
SOBOL as a base for the generation, of when using the stratified sampling
technique in Monte Carlo.
Would it be beyond the scope of this library to provide this kind of
support?
2. Following on from the last point, it would be very useful if SOBOL
sequence generation was included in the library.
3. I've noticed that at least one of the generators (Normal) uses a
sub-optimal generator. I've attached an alternative implementation which I
knocked together this evening which in my tests is about 30% faster. Note
this was heavily influenced by an algorithm described in "Numerical Recipies
in C".
4. The list of distributions where deviate generators are provided is quite
short. As mentioned before, I'm quite interested in this area, and would be
happy to help with algorithms for some other distributions, though sadly I
would estimate that my C++ skills are still quite a lot below the median
here.
All comments welcome,
Cheers
Darren
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk