
Boost Users : 
Subject: Re: [Boostusers] Declare statistical distribution array:boost/math/distributions
From: John Maddock (john_at_[hidden])
Date: 20090521 06:01:05
> I am trying to write a MCMC algorithm by using boost's math distribution
> library, what I want to do is to first declare an array of length 10 of
> gamma distribution, and then run a for loop to declare each gamma
> distribution's parameters. However, boost does not allow me to declare the
> gamma distribution array without having defining the parameter in advance:
>
> gamma_distribution<double> mydist10[10];
>
> error: no appropriate default constructor available.
>
> because the library requires to know the parameter of the gamma
> distribution
> in advance.
>
> Do you guys have any idea to overcome this ?
>
> Thanks a lot for any comment or suggestion.
There is an ugly workaround:
boost::math::gamma_distribution<> a[2] = {
boost::math::gamma_distribution<>(0),
boost::math::gamma_distribution<>(0), };
and then assignment works via:
a[0] = boost::math::gamma_distribution<>(par1, par2);
etc.
HTH, John.
Boostusers 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