Using boost's skewed_normal_distribution

2019-07-29 09:39发布

I am fairly new to c++ and boost.

I want to create a set of numbers that derived from a skewed distribution using Boost's skewed_normal_distribution class.

I'm not sure how to even start. I want to define a distribution with mean 0.05, variance 0.95, but a skew of 0.5. The following code doesn't work and I realise I need to set up a variate_generator as well.

Can anyone provide some pointers? I am not finding the boost documentation page on skew_normal_distribution very intuitive but that might be because of my inexperience.

Note the main problem I am getting is the message:

skew_normal_distribution’ is not a member of ‘boost

Many thanks

#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>

#include <boost/math/distributions/skew_normal.hpp>

int main () {
    boost::skew_normal_distribution<> normal(0.05, 0.95, 0.5);
    return 0;
}

1条回答
【Aperson】
2楼-- · 2019-07-29 09:44

Use boost::math::skew_normal_distribution instead of boost::skew_normal_distribution for the message

skew_normal_distribution is not a member of boost

查看更多
登录 后发表回答