Cela a déjà été adressé (Using boost's skewed_normal_distribution) mais j'ai rencontré des difficultés et le thread précédent n'incluait aucun code de solution.Utilisation de Boost skew_normal_distribution
Je voudrais échantillon d'une distribution asymétrique normale en utilisant les fonctions intégrées dans la bibliothèque Boost
J'adaptais code que je sais fonctionne très bien avec le normal_distribution <> classe mais quand je lance le code que je continue à recevoir l'erreur montrée ci-dessous. Si quelqu'un pouvait m'aider avec ça, je serais très reconnaissant.
#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/math/distributions/skew_normal.hpp>
int main() {
boost::mt19937 rng2;
boost::math::skew_normal_distribution<> snd(0.0, 1.0, 1.0);
boost::variate_generator<boost::mt19937&,
boost::math::skew_normal_distribution<> > var_snd(rng2, snd);
int i = 0; for (; i < 10; ++i)
{
double d = var_snd();
std::cout << d << std::endl;
}
return 0;
}
Erreur:
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
In file included from /usr/include/boost/random.hpp:55:0,
from /home/jack/CLionProjects/untitled/main.cpp:1:
/usr/include/boost/random/variate_generator.hpp: In instantiation of ‘class boost::random::variate_generator<boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>&, boost::math::skew_normal_distribution<double> >’:
/home/jack/CLionProjects/untitled/main.cpp:13:63: required from here
/usr/include/boost/random/variate_generator.hpp:59:48: error: no type named ‘result_type’ in ‘class boost::math::skew_normal_distribution<double>’
typedef typename Distribution::result_type result_type;
Jack