이 문제는 (Using boost's skewed_normal_distribution) 전에 해결되었지만 어려움이 있으며 이전 스레드에는 해결책 코드가 포함되어 있지 않습니다.부스트 사용 skew_normal_distribution
나는 내가 알고있는 코드를 채택하고
부스트 라이브러리에 내장 된 기능을 사용하여 왜곡 정규 분포에서 샘플링하고 싶은는 normal_distribution <> 클래스 잘 작동하지만이 코드를 실행하면 나는 점점 계속 오류는 아래와 같습니다. 누군가가 이것으로 나를 도울 수 있다면 매우 감사 할 것입니다.
#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;
}
오류 :
[ 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;
잭