Boost logo

Boost Users :

From: StephQ (pelux_at_[hidden])
Date: 2007-11-18 07:49:26


I am currently working on a mathematical library for the simulation of
stochastic processes. I am a researcher in Statistics, hence my limited skills
in c++ programming :)

Let me introduce the framework briefly.
The part of the library I am interested with is very similar to the boost random
library. I need to implement it because I need to extend some functionality and
I am not confident in modifying the boost random library to extend its behaviour
 (too complicated for me :P).

We have (lazy syntax):

PseudoRng<TImpl> //A particular pseduo random number generator
QuasiRng<TImpl> // A particualr quasi random number generator
GaussianDistribution // A particular statistical distribution

Sampler<GaussianDistribution> // The interface (for other components of the
library) of a sampler of random numbers distributed as a GaussianDistribution

Then I consider:

template <
  class TGenerator,
  class TDistribution,
  typename TDistribution::variate_t (TDistribution::*algorithm)( const
TGenerator& ) const = &TDistribution::sample_default >

class VariateSampler : public Sampler<TDistribution>
{
...
}

Here TGenerator can be PseudoRng<TImpl> or QuasiRng<TImpl>, TDistribution can be
GaussianDistribution and the pointer to member function algorithm select the
algorithm used to sample.

While constructing VariateSampler I would like to:
1) Automatically deduce the type of TGenerator and TDistribution
2) Automatically select a different default for algorithm, for particular
TDistribution (like GaussianDistribution,PoissonDistribution....) depending on
the fact that TGenerator is of type PseudoRng<TImpl> or QuasiRng<Timpl>. So for
every TDistribution two different defaults for algorithm.

I think that boost parameter should solve my problem, but I am quite confused
about how to implement it, expecially the second point. Could you help me with
the basic steps I need to consider?

Thank you very much in advance.

Regards
StephQ


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