32 #ifndef VSMC_RNG_MKL_HPP
33 #define VSMC_RNG_MKL_HPP
38 #define VSMC_STATIC_ASSERT_RNG_MKL_VSL_DISTRIBUTION_FP_TYPE(FPType, Dist) \
40 (cxx11::is_same<FPType, float>::value || \
41 cxx11::is_same<FPType, double>::value), \
42 USE_MKL##Dist##Distribution_##WITH_A_RESULT_TYPE_OTHER_THAN_float_OR_double)
44 #define VSMC_RUNTIME_ASSERT_RNG_MKL_VSL_OFFSET(offset) \
45 VSMC_RUNTIME_ASSERT((offset < max VSMC_MNE ()), \
46 ("**MKLOffsetDynamic** " \
47 "EXCESS MAXIMUM NUMBER OF INDEPDENT RNG STREAMS"))
49 #ifndef VSMC_RNG_MKL_VSL_BUFFER_SIZE
50 #define VSMC_RNG_MKL_VSL_BUFFER_SIZE 1024
53 #define VSMC_DEFINE_RNG_MKL_VSL_BRNG(BRNG) case BRNG : return #BRNG
55 #define VSMC_DEFINE_RNG_MKL_VSL_ERR(STATUS) case STATUS : return #STATUS
66 template <
typename, MKL_INT = VSL_RNG_METHOD_UNIFORM_STD>
69 template <MKL_INT = VSL_RNG_METHOD_BERNOULLI_ICDF>
71 template <MKL_INT = VSL_RNG_METHOD_GEOMETRIC_ICDF>
73 template <MKL_INT = VSL_RNG_METHOD_BINOMIAL_BTPE>
75 template <MKL_INT = VSL_RNG_METHOD_HYPERGEOMETRIC_H2PE>
77 template <MKL_INT = VSL_RNG_METHOD_POISSON_PTPE>
79 template <MKL_INT = VSL_RNG_METHOD_NEGBINOMIAL_NBAR>
81 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2>
83 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_EXPONENTIAL_ICDF>
85 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_LAPLACE_ICDF>
87 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_WEIBULL_ICDF>
89 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_CAUCHY_ICDF>
91 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_RAYLEIGH_ICDF>
93 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2>
95 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_GUMBEL_ICDF>
97 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_GAMMA_GNORM>
99 template <
typename =
double, MKL_INT = VSL_RNG_METHOD_BETA_CJA>
121 default :
return "Unknown";
159 default :
return "UNKNOWN";
163 #if VSMC_NO_RUNTIME_ASSERT
167 const char *func,
const char *mklf)
169 if (status == VSL_ERROR_OK)
172 std::string msg(
"**vsmc::");
175 msg +=
"; MKL function: ";
180 msg +=
"; Error code: ";
212 static_cast<unsigned>(~(
static_cast<unsigned>(0)));
223 static_cast<unsigned MKL_INT64
>(~(
static_cast<unsigned MKL_INT64
>(0)));
251 template <MKL_INT MaxOffset>
284 template <MKL_INT BRNG>
290 int status = ::vslSkipAheadStream(stream.
ptr(), nskip);
292 "MKLSkipAheadVSL::skip",
"::vslSkipAheadStream");
299 template <MKL_INT BRNG,
typename ResultType>
311 if (nskip < buffer_size_) {
312 if (buffer_.size() < nskip)
313 buffer_.resize(nskip);
314 uniform_bits_(stream, nskip, &buffer_[0]);
316 buffer_.resize(buffer_size_);
317 size_type repeat = nskip / buffer_size_;
318 size_type remain = nskip - repeat * buffer_size_;
319 for (size_type r = 1; r != repeat + 1; ++r) {
320 size_type n = r * buffer_size_;
321 uniform_bits_(stream, n, &buffer_[0]);
323 uniform_bits_(stream, remain, &buffer_[0]);
334 std::vector<ResultType, AlignedAllocator<ResultType> > buffer_;
339 template <MKL_INT BRNG,
typename ResultType>
343 template <
typename ResultType>
347 template <
typename ResultType>
351 template <
typename ResultType>
355 template <
typename ResultType>
359 template <
typename ResultType>
367 template <MKL_INT BRNG>
377 int status = VSL_ERROR_OK;
379 status = ::vslNewStream(&stream_ptr_, BRNG + this->
offset(), seed_);
381 "MKLStream::Stream",
"::vslNewStream");
383 status = ::vslGetBrngProperties(BRNG, &property_);
385 "MKLStream::Stream",
"::vslGetBrngProperties");
388 template <
typename SeedSeq>
394 seq.generate(&seed_, &seed_ + 1);
395 int status = VSL_ERROR_OK;
397 status = ::vslNewStream(&stream_ptr_, BRNG + this->
offset(), seed_);
399 "MKLStream::Stream",
"::vslNewStream");
401 status = ::vslGetBrngProperties(BRNG, &property_);
403 "MKLStream::Stream",
"::vslGetBrngProperties");
407 internal::MKLOffset<BRNG>::
type(other),
408 seed_(other.seed_), property_(other.property_)
410 int status = ::vslCopyStream(&stream_ptr_, other.stream_ptr_);
412 "MKLStream::Stream",
"::vslCopyStream");
417 if (
this != &other) {
419 int status = ::vslCopyStreamState(stream_ptr_, other.stream_ptr_);
421 "MKLStream::operator=",
"::vslCopyStreamState");
422 property_ = other.property_;
428 #if VSMC_HAS_CXX11_RVALUE_REFERENCES
430 internal::MKLOffset<BRNG>::
type(cxx11::
move(other)),
431 seed_(other.seed_), stream_ptr_(other.stream_ptr_),
432 property_(other.property_) {other.stream_ptr_ =
VSMC_NULLPTR;}
440 swap(seed_, other.seed_);
441 swap(stream_ptr_, other.stream_ptr_);
442 swap(property_, other.property_);
452 ::vslDeleteStream(&stream_ptr_);
458 int status = VSL_ERROR_OK;
461 status = ::vslNewStream(&stream_ptr_, BRNG + this->
offset(), s);
463 "MKLStream::seed",
"::vslNewStream");
465 VSLStreamStatePtr new_stream_ptr;
467 status = ::vslNewStream(&new_stream_ptr, BRNG + this->
offset(), s);
469 "MKLStream::seed",
"::vslNewStream");
471 status = ::vslCopyStreamState(stream_ptr_, new_stream_ptr);
473 "MKLStream::seed",
"::vslCopyStreamState");
475 status = ::vslDeleteStream(&new_stream_ptr);
477 "MKLStream::seed",
"::vslDeleteStream");
482 template <
typename SeedSeq>
487 seq.generate(&seed_, &seed_ + 1);
491 VSLStreamStatePtr
ptr ()
const {
return stream_ptr_;}
493 const VSLBRngProperties &
property ()
const {
return property_;}
498 VSLStreamStatePtr stream_ptr_;
499 VSLBRngProperties property_;
504 template <MKL_INT BRNG,
typename ResultType>
515 index_(buffer_size_) {}
517 template <
typename SeedSeq>
523 index_(buffer_size_) {}
525 void seed (MKL_UINT s) {stream_.seed(s);}
527 template <
typename SeedSeq>
536 if (index_ == buffer_size_) {
537 buffer_.resize(static_cast<std::size_t>(buffer_size_));
538 uniform_bits_(stream_, buffer_size_, &buffer_[0]);
542 return buffer_[
static_cast<std::size_t
>(index_++)];
554 skip_ahead_(stream_,
static_cast<typename
557 index_ = buffer_size_;
569 const stream_type &
stream ()
const {
return stream_;}
582 std::vector<result_type, AlignedAllocator<result_type> > buffer_;
626 template <
typename ResultType,
typename Derived>
636 template <MKL_INT BRNG>
639 if (index_ == buffer_size_) {
640 buffer_.resize(static_cast<std::size_t>(buffer_size_));
641 static_cast<Derived *
>(
this)->generate(stream, buffer_size_,
646 return buffer_[index_++];
649 template <MKL_INT BRNG>
651 {
static_cast<Derived *
>(
this)->generate(stream, n, r);}
653 void reset () {index_ = buffer_size_;}
663 template <MKL_INT BRNG>
666 if (status == VSL_ERROR_OK)
669 std::string dist_name(name);
670 dist_name =
"MKL" + dist_name +
"Distribution::generate";
671 std::string mkl_vsl_name(mkl_vsl_name_prefix(
672 static_cast<result_type>(0)));
673 mkl_vsl_name +=
"Rng";
674 mkl_vsl_name += name;
676 dist_name.c_str(), mkl_vsl_name.c_str());
681 std::vector<result_type, AlignedAllocator<result_type> > buffer_;
685 std::string mkl_vsl_name_prefix (
MKL_INT) {
return "vi";}
686 std::string mkl_vsl_name_prefix (
unsigned) {
return "vi";}
687 std::string mkl_vsl_name_prefix (
unsigned MKL_INT64) {
return "vi";}
688 std::string mkl_vsl_name_prefix (
float) {
return "vs";}
689 std::string mkl_vsl_name_prefix (
double) {
return "vd";}
701 template <MKL_INT BRNG>
704 int status = ::viRngUniformBits32(VSL_RNG_METHOD_UNIFORMBITS32_STD,
706 this->
template generate_error_check<BRNG>(status,
"UniformBits32");
719 template <MKL_INT BRNG>
722 int status = ::viRngUniformBits64(VSL_RNG_METHOD_UNIFORMBITS64_STD,
724 this->
template generate_error_check<BRNG>(status,
"UniformBits64");
730 template <
typename ResultType, MKL_INT Method>
731 class MKLUniformDistribution :
732 public MKLDistribution<ResultType,
733 MKLUniformDistribution<ResultType, Method> >
742 template <MKL_INT BRNG>
745 int status = generate(stream.
ptr(), n, r);
746 this->
template generate_error_check<BRNG>(status,
"Uniform");
755 {return ::viRngUniform(Method, ptr, n, r, a_, b_);}
757 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
758 {return ::vsRngUniform(Method, ptr, n, r, a_, b_);}
760 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
761 {return ::vdRngUniform(Method, ptr, n, r, a_, b_);}
766 template <MKL_INT Method>
767 class MKLBernoulliDistribution :
768 public MKLDistribution<MKL_INT, MKLBernoulliDistribution<Method> >
776 template <MKL_INT BRNG>
779 int status = ::viRngBernoulli(Method, stream.
ptr(), n, r, p_);
780 this->
template generate_error_check<BRNG>(status,
"Bernoulli");
790 template <MKL_INT Method>
791 class MKLGeometricDistribution :
792 public MKLDistribution<MKL_INT, MKLGeometricDistribution<Method> >
800 template <MKL_INT BRNG>
803 int status = ::viRngGeometric(Method, stream.
ptr(), n, r, p_);
804 this->
template generate_error_check<BRNG>(status,
"Geometric");
814 template <MKL_INT Method>
815 class MKLBinomialDistribution :
816 public MKLDistribution<MKL_INT, MKLBinomialDistribution<Method> >
823 ntrial_(ntrial), p_(p) {}
825 template <MKL_INT BRNG>
828 int status = ::viRngBinomial(Method, stream.
ptr(), n, r, ntrial_, p_);
829 this->
template generate_error_check<BRNG>(status,
"Binomial");
840 template <MKL_INT Method>
841 class MKLHypergeometricDistribution :
842 public MKLDistribution<MKL_INT, MKLHypergeometricDistribution<Method> >
850 l_(population), s_(sample), m_(mask) {}
852 template <MKL_INT BRNG>
855 int status = ::viRngHypergeometric(Method, stream.
ptr(),
857 this->
template generate_error_check<BRNG>(status,
"Hypergeometric");
869 template <MKL_INT Method>
870 class MKLPoissonDistribution :
871 public MKLDistribution<MKL_INT, MKLPoissonDistribution<Method> >
879 template <MKL_INT BRNG>
882 int status = ::viRngPoisson(Method, stream.
ptr(), n, r, lambda_);
883 this->
template generate_error_check<BRNG>(status,
"Poisson");
893 template <MKL_INT Method>
894 class MKLNegBinomialDistribution :
895 public MKLDistribution<MKL_INT, MKLNegBinomialDistribution<Method> >
902 ntrial_(ntrial), p_(p) {}
904 template <MKL_INT BRNG>
907 int status = ::viRngNegBinomial(Method, stream.
ptr(),
909 this->
template generate_error_check<BRNG>(status,
"NegBinomial");
920 template <
typename FPType, MKL_INT Method>
921 class MKLGaussianDistribution :
922 public MKLDistribution<FPType, MKLGaussianDistribution<FPType, Method> >
929 result_type sd = 1) : mean_(mean), sd_(sd)
932 template <MKL_INT BRNG>
935 int status = generate(stream.
ptr(), n, r);
936 this->
template generate_error_check<BRNG>(status,
"Gaussian");
944 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
945 {return ::vsRngGaussian(Method, ptr, n, r, mean_, sd_);}
947 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
948 {return ::vdRngGaussian(Method, ptr, n, r, mean_, sd_);}
953 template <
typename FPType, MKL_INT Method>
954 class MKLExponentialDistribution :
955 public MKLDistribution<FPType, MKLExponentialDistribution<FPType, Method> >
962 result_type scale = 1) : disp_(displacement), scale_(scale)
965 template <MKL_INT BRNG>
968 int status = generate(stream.
ptr(), n, r);
969 this->
template generate_error_check<BRNG>(status,
"Exponential");
977 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
978 {return ::vsRngExponential(Method, ptr, n, r, disp_, scale_);}
980 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
981 {return ::vdRngExponential(Method, ptr, n, r, disp_, scale_);}
986 template <
typename FPType, MKL_INT Method>
987 class MKLLaplaceDistribution :
988 public MKLDistribution<FPType, MKLLaplaceDistribution<FPType, Method> >
995 result_type scale = 1) : mean_(mean), scale_(scale)
998 template <MKL_INT BRNG>
1001 int status = generate(stream.
ptr(), n, r);
1002 this->
template generate_error_check<BRNG>(status,
"Laplace");
1010 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1011 {return ::vsRngLaplace(Method, ptr, n, r, mean_, scale_);}
1013 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1014 {return ::vdRngLaplace(Method, ptr, n, r, mean_, scale_);}
1019 template <
typename FPType, MKL_INT Method>
1020 class MKLWeibullDistribution :
1021 public MKLDistribution<FPType, MKLWeibullDistribution<FPType, Method> >
1028 result_type displacement = 0, result_type scale = 1) :
1029 shape_(shape), disp_(displacement), scale_(scale)
1032 template <MKL_INT BRNG>
1035 int status = generate(stream.
ptr(), n, r);
1036 this->
template generate_error_check<BRNG>(status,
"Weibull");
1045 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1046 {return ::vsRngWeibull(Method, ptr, n, r, shape_, disp_, scale_);}
1048 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1049 {return ::vdRngWeibull(Method, ptr, n, r, shape_, disp_, scale_);}
1054 template <
typename FPType, MKL_INT Method>
1055 class MKLCauchyDistribution :
1056 public MKLDistribution<FPType, MKLCauchyDistribution<FPType, Method> >
1063 result_type scale = 1) : disp_(displacement), scale_(scale)
1066 template <MKL_INT BRNG>
1069 int status = generate(stream.
ptr(), n, r);
1070 this->
template generate_error_check<BRNG>(status,
"Cauchy");
1078 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1079 {return ::vsRngCauchy(Method, ptr, n, r, disp_, scale_);}
1081 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1082 {return ::vdRngCauchy(Method, ptr, n, r, disp_, scale_);}
1087 template <
typename FPType, MKL_INT Method>
1088 class MKLRayleighDistribution :
1089 public MKLDistribution<FPType, MKLRayleighDistribution<FPType, Method> >
1096 result_type scale = 1) : disp_(displacement), scale_(scale)
1099 template <MKL_INT BRNG>
1102 int status = generate(stream.
ptr(), n, r);
1103 this->
template generate_error_check<BRNG>(status,
"Rayleigh");
1111 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1112 {return ::vsRngRayleigh(Method, ptr, n, r, disp_, scale_);}
1114 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1115 {return ::vdRngRayleigh(Method, ptr, n, r, disp_, scale_);}
1120 template <
typename FPType, MKL_INT Method>
1121 class MKLLognormalDistribution :
1122 public MKLDistribution<FPType, MKLLognormalDistribution<FPType, Method> >
1129 result_type mean = 0, result_type sd = 1,
1130 result_type displacement = 0, result_type scale = 1) :
1131 mean_(mean), sd_(sd), disp_(displacement), scale_(scale)
1134 template <MKL_INT BRNG>
1137 int status = generate(stream.
ptr(), n, r);
1138 this->
template generate_error_check<BRNG>(status,
"Lognormal");
1148 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1149 {return ::vsRngLognormal(Method, ptr, n, r, mean_, sd_, disp_, scale_);}
1151 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1152 {return ::vdRngLognormal(Method, ptr, n, r, mean_, sd_, disp_, scale_);}
1157 template <
typename FPType, MKL_INT Method>
1158 class MKLGumbelDistribution :
1159 public MKLDistribution<FPType, MKLGumbelDistribution<FPType, Method> >
1166 result_type scale = 1) : disp_(displacement), scale_(scale)
1169 template <MKL_INT BRNG>
1172 int status = generate(stream.
ptr(), n, r);
1173 this->
template generate_error_check<BRNG>(status,
"Gumbel");
1181 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1182 {return ::vsRngGumbel(Method, ptr, n, r, disp_, scale_);}
1184 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1185 {return ::vdRngGumbel(Method, ptr, n, r, disp_, scale_);}
1190 template <
typename FPType, MKL_INT Method>
1191 class MKLGammaDistribution :
1192 public MKLDistribution<FPType, MKLGammaDistribution<FPType, Method> >
1199 result_type displacement = 0, result_type scale = 1) :
1200 shape_(shape), disp_(displacement), scale_(scale)
1203 template <MKL_INT BRNG>
1206 int status = generate(stream.
ptr(), n, r);
1207 this->
template generate_error_check<BRNG>(status,
"Gamma");
1216 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1217 {return ::vsRngGamma(Method, ptr, n, r, shape_, disp_, scale_);}
1219 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1220 {return ::vdRngGamma(Method, ptr, n, r, shape_, disp_, scale_);}
1225 template <
typename FPType, MKL_INT Method>
1226 class MKLBetaDistribution :
1227 public MKLDistribution<FPType, MKLBetaDistribution<FPType, Method> >
1234 result_type shape1 = 1, result_type shape2 = 1,
1235 result_type displacement = 0, result_type scale = 1) :
1236 shape1_(shape1), shape2_(shape2), disp_(displacement), scale_(scale)
1239 template <MKL_INT BRNG>
1242 int status = generate(stream.
ptr(), n, r);
1243 this->
template generate_error_check<BRNG>(status,
"Beta");
1248 result_type shape1_;
1249 result_type shape2_;
1253 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
float *r)
1254 {return ::vsRngBeta(Method, ptr, n, r, shape1_, shape2_, disp_, scale_);}
1256 int generate (VSLStreamStatePtr ptr,
MKL_INT n,
double *r)
1257 {return ::vdRngBeta(Method, ptr, n, r, shape1_, shape2_, disp_, scale_);}
1262 #endif // VSMC_RNG_MKL_HPP
static constexpr const result_type _Min
MKLSkipAheadForce< BRNG, ResultType > type
MKLExponentialDistribution(result_type displacement=0, result_type scale=1)
MKLEngine< VSL_BRNG_NONDETERM, unsigned MKL_INT64 > MKL_NONDETERM_64
A non-determinstic random number generator (64-bits)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLEngine< VSL_BRNG_MT19937, unsigned > MKL_MT19937
A Mersenne-Twister pseudoranom number genertor.
static constexpr result_type min()
Default seed for MKL RNG.
MKLEngine< VSL_BRNG_MT19937, unsigned MKL_INT64 > MKL_MT19937_64
A Mersenne-Twister pseudoranom number genertor (64-bits)
static constexpr MKL_INT max()
MKL_INT buffer_size() const
#define VSMC_CONSTEXPR
constexpr
MKLStream(MKLStream< BRNG > &&other)
MKL Hypergeometric distribution.
static constexpr MKL_INT offset()
MKLGaussianDistribution(result_type mean=0, result_type sd=1)
std::string mkl_vsl_brng_str(MKL_INT BRNG)
#define VSMC_RNG_MKL_VSL_BUFFER_SIZE
MKLLognormalDistribution(result_type mean=0, result_type sd=1, result_type displacement=0, result_type scale=1)
MKLStream< BRNG > & operator=(const MKLStream< BRNG > &other)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLEngine< VSL_BRNG_MT2203, unsigned MKL_INT64 > MKL_MT2203_64
A set of 6024 Mersenne-Twister pseudoranom number genertor (64-bits)
void buffer_size(MKL_INT size)
Set the buffer size, zero or negative value restore the default.
void buffer_size(MKL_INT size)
Set the buffer size, zero or negative value restore the default.
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLGeometricDistribution(double p=0.5)
MKLPoissonDistribution(double lambda=1)
MKLLaplaceDistribution(result_type mean=0, result_type scale=1)
MKLStream(SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, MKL_UINT, MKLStream< BRNG > >::value >::type *=nullptr)
void generate_error_check(int status, const char *name)
MKLStream(MKL_UINT s=traits::MKLSeedTrait< BRNG >::value, MKL_INT offset=0)
void operator()(MKLStream< BRNG > &stream, size_type nskip)
MKLEngine< VSL_BRNG_NONDETERM, unsigned > MKL_NONDETERM
A non-determinstic random number generator.
MKL Geometric distribution.
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
const VSLBRngProperties & property() const
const stream_type & stream() const
#define VSMC_RUNTIME_ASSERT(cond, msg)
MKLNegBinomialDistribution(double ntrial=1, double p=0.5)
static constexpr MKL_INT min()
MKLEngine< VSL_BRNG_MCG59, unsigned > MKL_MCG59
A 59-bits multiplicative congruential generator.
#define VSMC_DEFINE_RNG_MKL_VSL_ERR(STATUS)
MKLBinomialDistribution(result_type ntrial=1, double p=0.5)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKL NegBinomial distribution.
MKLGumbelDistribution(result_type displacement=0, result_type scale=1)
void buffer_size(MKL_INT size)
MKL Poisson distribution.
MKLBetaDistribution(result_type shape1=1, result_type shape2=1, result_type displacement=0, result_type scale=1)
MKLOffsetDynamic< 6024 > type
void discard(std::size_t nskip)
Discard results.
#define VSMC_MNE
Avoid MSVC stupid behavior: MNE = Macro No Expansion.
#define VSMC_DEFINE_RNG_MKL_VSL_BRNG(BRNG)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLEngine< VSL_BRNG_SFMT19937, unsigned MKL_INT64 > MKL_SFMT19937_64
A SIMD-oriented fast Mersenne-Twister pseudoranom number genertor (64-bits)
Base class of MKL distribution.
MKLCauchyDistribution(result_type displacement=0, result_type scale=1)
static constexpr const result_type _Max
MKLEngine< VSL_BRNG_SFMT19937, unsigned > MKL_SFMT19937
A SIMD-oriented fast Mersenne-Twister pseudoranom number genertor.
MKLStream(const MKLStream< BRNG > &other)
MKL Exponential distribution.
MKLStream< BRNG > stream_type
static constexpr result_type max()
remove_reference< T >::type && move(T &&t) noexcept
void seed(SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, MKL_UINT, MKLStream< BRNG > >::value >::type *=nullptr)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
void seed(SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, MKL_UINT, MKLEngine< BRNG, ResultType > >::value >::type *=nullptr)
static constexpr MKL_INT min()
MKL Binomial distribution.
VSLStreamStatePtr ptr() const
MKLBernoulliDistribution(double p=0.5)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
#define VSMC_NULLPTR
nullptr
void mkl_vsl_error_check(MKL_INT BRNG, int status, const char *func, const char *mklf)
MKL Rayleigh distribution.
void swap(Array< T, N > &ary1, Array< T, N > &ary2)
Array ADL of swap.
#define VSMC_RUNTIME_ASSERT_RNG_MKL_VSL_OFFSET(offset)
MKLEngine(MKL_UINT s=traits::MKLSeedTrait< BRNG >::value, MKL_INT offset=0)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLRayleighDistribution(result_type displacement=0, result_type scale=1)
MKL RNG C++11 engine stream.
void operator()(MKLStream< BRNG > &stream, size_type nskip)
MKL Laplace distribution.
MKLOffsetDynamic< 273 > type
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
static constexpr MKL_INT max()
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
static void offset(MKL_INT)
MKLEngine(SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, MKL_UINT, MKLEngine< BRNG, ResultType > >::value >::type *=nullptr)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLGammaDistribution(result_type shape=1, result_type displacement=0, result_type scale=1)
MKL Lognormal distribution.
static void buffer_size(MKL_INT)
std::string mkl_vsl_error_str(int status)
MKL Weibull distribution.
MKL Bernoulli distribution.
static MKL_INT buffer_size()
MKLWeibullDistribution(result_type shape=1, result_type displacement=0, result_type scale=1)
MKL Gaussian distribution.
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLEngine< VSL_BRNG_MT2203, unsigned > MKL_MT2203
A set of 6024 Mersenne-Twister pseudoranom number genertor.
#define VSMC_STATIC_ASSERT_RNG_MKL_VSL_DISTRIBUTION_FP_TYPE(FPType, Dist)
void generate(MKLStream< BRNG > &stream, MKL_INT n, result_type *r)
MKLHypergeometricDistribution(result_type population, result_type sample, result_type mask)
result_type operator()(MKLStream< BRNG > &stream)