diff options
Diffstat (limited to 'libcxx/include/random')
-rw-r--r-- | libcxx/include/random | 843 |
1 files changed, 642 insertions, 201 deletions
diff --git a/libcxx/include/random b/libcxx/include/random index 5de738ad907..5a74f639bd8 100644 --- a/libcxx/include/random +++ b/libcxx/include/random @@ -1663,6 +1663,7 @@ template <unsigned long long __a, unsigned long long __c, unsigned long long __m struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), true> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { // Schrage's algorithm @@ -1680,6 +1681,7 @@ template <unsigned long long __a, unsigned long long __m> struct __lce_ta<__a, 0, __m, (unsigned long long)(~0), true> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { // Schrage's algorithm @@ -1696,6 +1698,7 @@ template <unsigned long long __a, unsigned long long __c, unsigned long long __m struct __lce_ta<__a, __c, __m, (unsigned long long)(~0), false> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return (__a * __x + __c) % __m; @@ -1706,6 +1709,7 @@ template <unsigned long long __a, unsigned long long __c> struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false> { typedef unsigned long long result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return __a * __x + __c; @@ -1718,6 +1722,7 @@ template <unsigned long long _A, unsigned long long _C, unsigned long long _M> struct __lce_ta<_A, _C, _M, unsigned(~0), true> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast<result_type>(_A); @@ -1738,6 +1743,7 @@ template <unsigned long long _A, unsigned long long _M> struct __lce_ta<_A, 0, _M, unsigned(~0), true> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast<result_type>(_A); @@ -1756,6 +1762,7 @@ template <unsigned long long _A, unsigned long long _C, unsigned long long _M> struct __lce_ta<_A, _C, _M, unsigned(~0), false> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast<result_type>(_A); @@ -1769,6 +1776,7 @@ template <unsigned long long _A, unsigned long long _C> struct __lce_ta<_A, _C, 0, unsigned(~0), false> { typedef unsigned result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { const result_type __a = static_cast<result_type>(_A); @@ -1783,6 +1791,7 @@ template <unsigned long long __a, unsigned long long __c, unsigned long long __m struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b> { typedef unsigned short result_type; + _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { return static_cast<result_type>(__lce_ta<__a, __c, __m, unsigned(~0)>::next(__x)); @@ -1805,7 +1814,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_U, _A, _C, _N>& __x); template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> -class linear_congruential_engine +class _LIBCPP_VISIBLE linear_congruential_engine { public: // types @@ -1827,20 +1836,26 @@ public: static const/*expr*/ result_type multiplier = __a; static const/*expr*/ result_type increment = __c; static const/*expr*/ result_type modulus = __m; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() {return _Min;} + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() {return _Max;} static const/*expr*/ result_type default_seed = 1u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit linear_congruential_engine(result_type __s = default_seed) {seed(__s);} template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0) {seed(__q);} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __s = default_seed) {seed(integral_constant<bool, __m == 0>(), integral_constant<bool, __c == 0>(), __s);} template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -1852,23 +1867,31 @@ public: : (__m-1) / 0x100000000ull)>());} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _M>::next(__x_));} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - friend bool operator==(const linear_congruential_engine& __x, - const linear_congruential_engine& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const linear_congruential_engine& __x, + const linear_congruential_engine& __y) {return __x.__x_ == __y.__x_;} - friend bool operator!=(const linear_congruential_engine& __x, - const linear_congruential_engine& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const linear_congruential_engine& __x, + const linear_congruential_engine& __y) {return !(__x == __y);} private: + _LIBCPP_INLINE_VISIBILITY void seed(true_type, true_type, result_type __s) {__x_ = __s == 0 ? 1 : __s;} + _LIBCPP_INLINE_VISIBILITY void seed(true_type, false_type, result_type __s) {__x_ = __s;} + _LIBCPP_INLINE_VISIBILITY void seed(false_type, true_type, result_type __s) {__x_ = __s % __m == 0 ? 1 : __s % __m;} + _LIBCPP_INLINE_VISIBILITY void seed(false_type, false_type, result_type __s) {__x_ = __s % __m;} template<class _Sseq> @@ -1931,11 +1954,13 @@ class __save_flags __save_flags(const __save_flags&); __save_flags& operator=(const __save_flags&); public: + _LIBCPP_INLINE_VISIBILITY explicit __save_flags(__stream_type& __stream) : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {} + _LIBCPP_INLINE_VISIBILITY ~__save_flags() { __stream_.flags(__fmtflags_); @@ -1945,7 +1970,7 @@ public: template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> -inline +inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) @@ -2022,7 +2047,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> -class mersenne_twister_engine +class _LIBCPP_VISIBLE mersenne_twister_engine { public: // types @@ -2067,18 +2092,23 @@ public: static const/*expr*/ result_type tempering_c = __c; static const/*expr*/ size_t tempering_l = __l; static const/*expr*/ result_type initialization_multiplier = __f; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const/*expr*/ result_type default_seed = 5489u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit mersenne_twister_engine(result_type __sd = default_seed) {seed(__sd);} template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0) {seed(__q);} void seed(result_type __sd = default_seed); template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2089,6 +2119,7 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R, @@ -2138,6 +2169,7 @@ private: void __seed(_Sseq& __q, integral_constant<unsigned, 2>); template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2147,6 +2179,7 @@ private: __lshift(result_type __x) {return (__x << __count) & _Max;} template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2156,6 +2189,7 @@ private: __lshift(result_type __x) {return result_type(0);} template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2165,6 +2199,7 @@ private: __rshift(result_type __x) {return __x >> __count;} template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2305,7 +2340,7 @@ operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R, _UI _A, size_t _U, _UI _D, size_t _S, _UI _B, size_t _T, _UI _C, size_t _L, _UI _F> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, _B, _T, _C, _L, _F>& __x, @@ -2400,7 +2435,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UI, _W, _S, _R>& __x); template<class _UIntType, size_t __w, size_t __s, size_t __r> -class subtract_with_carry_engine +class _LIBCPP_VISIBLE subtract_with_carry_engine { public: // types @@ -2426,19 +2461,25 @@ public: static const/*expr*/ size_t word_size = __w; static const/*expr*/ size_t short_lag = __s; static const/*expr*/ size_t long_lag = __r; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const/*expr*/ result_type default_seed = 19780503u; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY explicit subtract_with_carry_engine(result_type __sd = default_seed) {seed(__sd);} template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0) {seed(__q);} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd = default_seed) {seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());} template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2449,6 +2490,7 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} template<class _UI, size_t _W, size_t _S, size_t _R> @@ -2604,7 +2646,7 @@ operator==( } template<class _UI, size_t _W, size_t _S, size_t _R> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, @@ -2659,7 +2701,7 @@ typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base; // discard_block_engine template<class _Engine, size_t __p, size_t __r> -class discard_block_engine +class _LIBCPP_VISIBLE discard_block_engine { _Engine __e_; int __n_; @@ -2678,25 +2720,36 @@ public: static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Engine::min(); } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Engine::max(); } // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY discard_block_engine() : __n_(0) {} + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) : __e_(_STD::move(__e)), __n_(0) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} - template<class _Sseq> explicit discard_block_engine(_Sseq& __q, + template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY + explicit discard_block_engine(_Sseq& __q, typename enable_if<!is_convertible<_Sseq, result_type>::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q), __n_(0) {} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed(); __n_ = 0;} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd); __n_ = 0;} template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2706,9 +2759,11 @@ public: // generating functions result_type operator()(); + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} template<class _Eng, size_t _P, size_t _R> @@ -2754,7 +2809,7 @@ discard_block_engine<_Engine, __p, __r>::operator()() } template<class _Eng, size_t _P, size_t _R> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator==(const discard_block_engine<_Eng, _P, _R>& __x, const discard_block_engine<_Eng, _P, _R>& __y) @@ -2763,7 +2818,7 @@ operator==(const discard_block_engine<_Eng, _P, _R>& __x, } template<class _Eng, size_t _P, size_t _R> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const discard_block_engine<_Eng, _P, _R>& __x, const discard_block_engine<_Eng, _P, _R>& __y) @@ -2809,7 +2864,7 @@ typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48; // independent_bits_engine template<class _Engine, size_t __w, class _UIntType> -class independent_bits_engine +class _LIBCPP_VISIBLE independent_bits_engine { template <class _UI, _UI _R0, size_t _W, size_t _M> class __get_n @@ -2865,25 +2920,35 @@ public: static_assert(_Min < _Max, "independent_bits_engine invalid parameters"); // engine characteristics + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY independent_bits_engine() {} + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) : __e_(_STD::move(__e)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} template<class _Sseq> explicit independent_bits_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if<!is_convertible<_Sseq, result_type>::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed();} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd);} template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -2892,10 +2957,13 @@ public: seed(_Sseq& __q) {__e_.seed(__q);} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __eval(integral_constant<bool, _R != 0>());} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} template<class _Eng, size_t _W, class _UI> @@ -2931,6 +2999,7 @@ private: result_type __eval(true_type); template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2940,6 +3009,7 @@ private: __lshift(result_type __x) {return __x << __count;} template <size_t __count> + _LIBCPP_INLINE_VISIBILITY static typename enable_if < @@ -2950,7 +3020,7 @@ private: }; template<class _Engine, size_t __w, class _UIntType> -inline +inline _LIBCPP_INLINE_VISIBILITY _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) { @@ -2984,7 +3054,7 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) } template<class _Eng, size_t _W, class _UI> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator==( const independent_bits_engine<_Eng, _W, _UI>& __x, @@ -2994,7 +3064,7 @@ operator==( } template<class _Eng, size_t _W, class _UI> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const independent_bits_engine<_Eng, _W, _UI>& __x, @@ -3052,7 +3122,7 @@ public: }; template<class _Engine, size_t __k> -class shuffle_order_engine +class _LIBCPP_VISIBLE shuffle_order_engine { static_assert(0 < __k, "shuffle_order_engine invalid parameters"); public: @@ -3071,27 +3141,37 @@ public: static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; static_assert(_Min < _Max, "shuffle_order_engine invalid parameters"); + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max; } static const unsigned long long _R = _Max - _Min + 1ull; // constructors and seeding functions + _LIBCPP_INLINE_VISIBILITY shuffle_order_engine() {__init();} + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) {__init();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) : __e_(_STD::move(__e)) {__init();} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q, + _LIBCPP_INLINE_VISIBILITY typename enable_if<!is_convertible<_Sseq, result_type>::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {__init();} + _LIBCPP_INLINE_VISIBILITY void seed() {__e_.seed(); __init();} + _LIBCPP_INLINE_VISIBILITY void seed(result_type __sd) {__e_.seed(__sd); __init();} template<class _Sseq> + _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_convertible<_Sseq, result_type>::value, @@ -3100,10 +3180,13 @@ public: seed(_Sseq& __q) {__e_.seed(__q); __init();} // generating functions + _LIBCPP_INLINE_VISIBILITY result_type operator()() {return __eval(integral_constant<bool, _R != 0>());} + _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions + _LIBCPP_INLINE_VISIBILITY const _Engine& base() const {return __e_;} private: @@ -3135,6 +3218,7 @@ private: operator>>(basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_Eng, _K>& __x); + _LIBCPP_INLINE_VISIBILITY void __init() { for (size_t __i = 0; __i < __k; ++__i) @@ -3142,13 +3226,18 @@ private: _Y_ = __e_(); } + _LIBCPP_INLINE_VISIBILITY result_type __eval(false_type) {return __eval2(integral_constant<bool, __k & 1>());} + _LIBCPP_INLINE_VISIBILITY result_type __eval(true_type) {return __eval(__uratio<__k, _R>());} + _LIBCPP_INLINE_VISIBILITY result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());} + _LIBCPP_INLINE_VISIBILITY result_type __eval2(true_type) {return __evalf<__k, 0>();} template <uint64_t _N, uint64_t _D> + _LIBCPP_INLINE_VISIBILITY typename enable_if < (__uratio<_N, _D>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), @@ -3158,6 +3247,7 @@ private: {return __evalf<__uratio<_N, _D>::num, __uratio<_N, _D>::den>();} template <uint64_t _N, uint64_t _D> + _LIBCPP_INLINE_VISIBILITY typename enable_if < __uratio<_N, _D>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), @@ -3173,6 +3263,7 @@ private: } template <uint64_t __n, uint64_t __d> + _LIBCPP_INLINE_VISIBILITY result_type __evalf() { const double _F = __d == 0 ? @@ -3196,7 +3287,7 @@ operator==( } template<class _Eng, size_t _K> -inline +inline _LIBCPP_INLINE_VISIBILITY bool operator!=( const shuffle_order_engine<_Eng, _K>& __x, @@ -3249,7 +3340,7 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b; // random_device -class random_device +class _LIBCPP_VISIBLE random_device { int __f_; public: @@ -3260,7 +3351,9 @@ public: static const result_type _Min = 0; static const result_type _Max = 0xFFFFFFFFu; + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type min() { return _Min;} + _LIBCPP_INLINE_VISIBILITY static const/*expr*/ result_type max() { return _Max;} // constructors @@ -3281,7 +3374,7 @@ private: // seed_seq -class seed_seq +class _LIBCPP_VISIBLE seed_seq { public: // types @@ -3294,11 +3387,14 @@ private: void init(_InputIterator __first, _InputIterator __last); public: // constructors + _LIBCPP_INLINE_VISIBILITY seed_seq() {} template<class _Tp> + _LIBCPP_INLINE_VISIBILITY seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());} template<class _InputIterator> + _LIBCPP_INLINE_VISIBILITY seed_seq(_InputIterator __first, _InputIterator __last) {init(__first, __last);} @@ -3307,8 +3403,10 @@ public: void generate(_RandomAccessIterator __first, _RandomAccessIterator __last); // property functions + _LIBCPP_INLINE_VISIBILITY size_t size() const {return __v_.size();} template<class _OutputIterator> + _LIBCPP_INLINE_VISIBILITY void param(_OutputIterator __dest) const {_STD::copy(__v_.begin(), __v_.end(), __dest);} @@ -3317,6 +3415,7 @@ private: seed_seq(const seed_seq&); // = delete; void operator=(const seed_seq&); // = delete; + _LIBCPP_INLINE_VISIBILITY static result_type _T(result_type __x) {return __x ^ (__x >> 27);} }; @@ -3446,29 +3545,34 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // uniform_real_distribution template<class _RealType = double> -class uniform_real_distribution +class _LIBCPP_VISIBLE uniform_real_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef uniform_real_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3477,37 +3581,50 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit uniform_real_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit uniform_real_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return a();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return b();} - friend bool operator==(const uniform_real_distribution& __x, - const uniform_real_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const uniform_real_distribution& __x, + const uniform_real_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const uniform_real_distribution& __x, - const uniform_real_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const uniform_real_distribution& __x, + const uniform_real_distribution& __y) {return !(__x == __y);} }; template<class _RealType> template<class _URNG> -inline +inline _LIBCPP_INLINE_VISIBILITY typename uniform_real_distribution<_RealType>::result_type uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { @@ -3549,25 +3666,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // bernoulli_distribution -class bernoulli_distribution +class _LIBCPP_VISIBLE bernoulli_distribution { public: // types typedef bool result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __p_; public: typedef bernoulli_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3576,35 +3697,47 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit bernoulli_distribution(double __p = 0.5) : __p_(param_type(__p)) {} + _LIBCPP_INLINE_VISIBILITY explicit bernoulli_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return false;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return true;} - friend bool operator==(const bernoulli_distribution& __x, - const bernoulli_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const bernoulli_distribution& __x, + const bernoulli_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const bernoulli_distribution& __x, - const bernoulli_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const bernoulli_distribution& __x, + const bernoulli_distribution& __y) {return !(__x == __y);} }; template<class _URNG> -inline +inline _LIBCPP_INLINE_VISIBILITY bernoulli_distribution::result_type bernoulli_distribution::operator()(_URNG& __g, const param_type& __p) { @@ -3642,13 +3775,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) // binomial_distribution template<class _IntType = int> -class binomial_distribution +class _LIBCPP_VISIBLE binomial_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __t_; double __p_; @@ -3660,12 +3793,16 @@ public: explicit param_type(result_type __t = 1, double __p = 0.5); + _LIBCPP_INLINE_VISIBILITY result_type t() const {return __t_;} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class binomial_distribution; @@ -3676,31 +3813,44 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit binomial_distribution(result_type __t = 1, double __p = 0.5) : __p_(param_type(__t, __p)) {} + _LIBCPP_INLINE_VISIBILITY explicit binomial_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type t() const {return __p_.t();} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return t();} - friend bool operator==(const binomial_distribution& __x, - const binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const binomial_distribution& __x, + const binomial_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const binomial_distribution& __x, - const binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const binomial_distribution& __x, + const binomial_distribution& __y) {return !(__x == __y);} }; @@ -3790,25 +3940,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // exponential_distribution template<class _RealType = double> -class exponential_distribution +class _LIBCPP_VISIBLE exponential_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __lambda_; public: typedef exponential_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {} + _LIBCPP_INLINE_VISIBILITY result_type lambda() const {return __lambda_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__lambda_ == __y.__lambda_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3817,30 +3971,42 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit exponential_distribution(result_type __lambda = 1) : __p_(param_type(__lambda)) {} + _LIBCPP_INLINE_VISIBILITY explicit exponential_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type lambda() const {return __p_.lambda();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const exponential_distribution& __x, - const exponential_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const exponential_distribution& __x, + const exponential_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const exponential_distribution& __x, - const exponential_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const exponential_distribution& __x, + const exponential_distribution& __y) {return !(__x == __y);} }; @@ -3889,28 +4055,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // normal_distribution template<class _RealType = double> -class normal_distribution +class _LIBCPP_VISIBLE normal_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __mean_; result_type __stddev_; public: typedef normal_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __mean = 0, result_type __stddev = 1) : __mean_(__mean), __stddev_(__stddev) {} + _LIBCPP_INLINE_VISIBILITY result_type mean() const {return __mean_;} + _LIBCPP_INLINE_VISIBILITY result_type stddev() const {return __stddev_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -3921,33 +4092,46 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit normal_distribution(result_type __mean = 0, result_type __stddev = 1) : __p_(param_type(__mean, __stddev)), _V_hot_(false) {} + _LIBCPP_INLINE_VISIBILITY explicit normal_distribution(const param_type& __p) : __p_(__p), _V_hot_(false) {} + _LIBCPP_INLINE_VISIBILITY void reset() {_V_hot_ = false;} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type mean() const {return __p_.mean();} + _LIBCPP_INLINE_VISIBILITY result_type stddev() const {return __p_.stddev();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits<result_type>::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const normal_distribution& __x, - const normal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const normal_distribution& __x, + const normal_distribution& __y) {return __x.__p_ == __y.__p_ && __x._V_hot_ == __y._V_hot_ && (!__x._V_hot_ || __x._V_ == __y._V_);} - friend bool operator!=(const normal_distribution& __x, - const normal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const normal_distribution& __x, + const normal_distribution& __y) {return !(__x == __y);} template <class _CharT, class _Traits, class _RT> @@ -4039,27 +4223,32 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // lognormal_distribution template<class _RealType = double> -class lognormal_distribution +class _LIBCPP_VISIBLE lognormal_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { normal_distribution<result_type> __nd_; public: typedef lognormal_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __m = 0, result_type __s = 1) : __nd_(__m, __s) {} + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __nd_.mean();} + _LIBCPP_INLINE_VISIBILITY result_type s() const {return __nd_.stddev();} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__nd_ == __y.__nd_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class lognormal_distribution; @@ -4081,33 +4270,48 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit lognormal_distribution(result_type __m = 0, result_type __s = 1) : __p_(param_type(__m, __s)) {} + _LIBCPP_INLINE_VISIBILITY explicit lognormal_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {__p_.__nd_.reset();} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return _STD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));} // property functions + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __p_.m();} + _LIBCPP_INLINE_VISIBILITY result_type s() const {return __p_.s();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const lognormal_distribution& __x, - const lognormal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const lognormal_distribution& __x, + const lognormal_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const lognormal_distribution& __x, - const lognormal_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const lognormal_distribution& __x, + const lognormal_distribution& __y) {return !(__x == __y);} template <class _CharT, class _Traits, class _RT> @@ -4124,7 +4328,7 @@ public: }; template <class _CharT, class _Traits, class _RT> -inline +inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RT>& __x) @@ -4133,7 +4337,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template <class _CharT, class _Traits, class _RT> -inline +inline _LIBCPP_INLINE_VISIBILITY basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RT>& __x) @@ -4144,13 +4348,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // poisson_distribution template<class _IntType = int> -class poisson_distribution +class _LIBCPP_VISIBLE poisson_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __mean_; double __s_; @@ -4168,11 +4372,14 @@ public: explicit param_type(double __mean = 1.0); + _LIBCPP_INLINE_VISIBILITY double mean() const {return __mean_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__mean_ == __y.__mean_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} friend class poisson_distribution; @@ -4183,29 +4390,41 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit poisson_distribution(double __mean = 1.0) : __p_(__mean) {} + _LIBCPP_INLINE_VISIBILITY explicit poisson_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY double mean() const {return __p_.mean();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::max();} - friend bool operator==(const poisson_distribution& __x, - const poisson_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const poisson_distribution& __x, + const poisson_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const poisson_distribution& __x, - const poisson_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const poisson_distribution& __x, + const poisson_distribution& __y) {return !(__x == __y);} }; @@ -4360,28 +4579,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // weibull_distribution template<class _RealType = double> -class weibull_distribution +class _LIBCPP_VISIBLE weibull_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef weibull_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4390,34 +4614,49 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit weibull_distribution(result_type __a = 1, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit weibull_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return __p.b() * _STD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());} // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const weibull_distribution& __x, - const weibull_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const weibull_distribution& __x, + const weibull_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const weibull_distribution& __x, - const weibull_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const weibull_distribution& __x, + const weibull_distribution& __y) {return !(__x == __y);} }; @@ -4454,28 +4693,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, } template<class _RealType = double> -class extreme_value_distribution +class _LIBCPP_VISIBLE extreme_value_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef extreme_value_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4484,32 +4728,45 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit extreme_value_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit extreme_value_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits<result_type>::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const extreme_value_distribution& __x, - const extreme_value_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const extreme_value_distribution& __x, + const extreme_value_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const extreme_value_distribution& __x, - const extreme_value_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const extreme_value_distribution& __x, + const extreme_value_distribution& __y) {return !(__x == __y);} }; @@ -4557,28 +4814,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // gamma_distribution template<class _RealType = double> -class gamma_distribution +class _LIBCPP_VISIBLE gamma_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __alpha_; result_type __beta_; public: typedef gamma_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __alpha = 1, result_type __beta = 1) : __alpha_(__alpha), __beta_(__beta) {} + _LIBCPP_INLINE_VISIBILITY result_type alpha() const {return __alpha_;} + _LIBCPP_INLINE_VISIBILITY result_type beta() const {return __beta_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4587,32 +4849,45 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit gamma_distribution(result_type __alpha = 1, result_type __beta = 1) : __p_(param_type(__alpha, __beta)) {} + _LIBCPP_INLINE_VISIBILITY explicit gamma_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type alpha() const {return __p_.alpha();} + _LIBCPP_INLINE_VISIBILITY result_type beta() const {return __p_.beta();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const gamma_distribution& __x, - const gamma_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const gamma_distribution& __x, + const gamma_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const gamma_distribution& __x, - const gamma_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const gamma_distribution& __x, + const gamma_distribution& __y) {return !(__x == __y);} }; @@ -4711,28 +4986,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // negative_binomial_distribution template<class _IntType = int> -class negative_binomial_distribution +class _LIBCPP_VISIBLE negative_binomial_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __k_; double __p_; public: typedef negative_binomial_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY result_type k() const {return __k_;} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4741,31 +5021,44 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit negative_binomial_distribution(result_type __k = 1, double __p = 0.5) : __p_(__k, __p) {} + _LIBCPP_INLINE_VISIBILITY explicit negative_binomial_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type k() const {return __p_.k();} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::max();} - friend bool operator==(const negative_binomial_distribution& __x, - const negative_binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const negative_binomial_distribution& __x, + const negative_binomial_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const negative_binomial_distribution& __x, - const negative_binomial_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const negative_binomial_distribution& __x, + const negative_binomial_distribution& __y) {return !(__x == __y);} }; @@ -4828,25 +5121,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // geometric_distribution template<class _IntType = int> -class geometric_distribution +class _LIBCPP_VISIBLE geometric_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { double __p_; public: typedef geometric_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4855,30 +5152,44 @@ private: public: // constructors and reset functions + _LIBCPP_INLINE_VISIBILITY explicit geometric_distribution(double __p = 0.5) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY explicit geometric_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return negative_binomial_distribution<result_type>(1, __p.p())(__g);} // property functions + _LIBCPP_INLINE_VISIBILITY double p() const {return __p_.p();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::max();} - friend bool operator==(const geometric_distribution& __x, - const geometric_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const geometric_distribution& __x, + const geometric_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const geometric_distribution& __x, - const geometric_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const geometric_distribution& __x, + const geometric_distribution& __y) {return !(__x == __y);} }; @@ -4912,25 +5223,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // chi_squared_distribution template<class _RealType = double> -class chi_squared_distribution +class _LIBCPP_VISIBLE chi_squared_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __n_; public: typedef chi_squared_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __n = 1) : __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -4939,32 +5254,46 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit chi_squared_distribution(result_type __n = 1) : __p_(param_type(__n)) {} + _LIBCPP_INLINE_VISIBILITY explicit chi_squared_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} - template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g, const param_type& __p) {return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);} // property functions + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const chi_squared_distribution& __x, - const chi_squared_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const chi_squared_distribution& __x, + const chi_squared_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const chi_squared_distribution& __x, - const chi_squared_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const chi_squared_distribution& __x, + const chi_squared_distribution& __y) {return !(__x == __y);} }; @@ -5000,28 +5329,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // cauchy_distribution template<class _RealType = double> -class cauchy_distribution +class _LIBCPP_VISIBLE cauchy_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __a_; result_type __b_; public: typedef cauchy_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {} + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __a_;} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __b_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5030,38 +5364,51 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit cauchy_distribution(result_type __a = 0, result_type __b = 1) : __p_(param_type(__a, __b)) {} + _LIBCPP_INLINE_VISIBILITY explicit cauchy_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type a() const {return __p_.a();} + _LIBCPP_INLINE_VISIBILITY result_type b() const {return __p_.b();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits<result_type>::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const cauchy_distribution& __x, - const cauchy_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const cauchy_distribution& __x, + const cauchy_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const cauchy_distribution& __x, - const cauchy_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const cauchy_distribution& __x, + const cauchy_distribution& __y) {return !(__x == __y);} }; template <class _RealType> template<class _URNG> -inline +inline _LIBCPP_INLINE_VISIBILITY _RealType cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { @@ -5105,28 +5452,33 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // fisher_f_distribution template<class _RealType = double> -class fisher_f_distribution +class _LIBCPP_VISIBLE fisher_f_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __m_; result_type __n_; public: typedef fisher_f_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __m_;} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5135,32 +5487,45 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1) : __p_(param_type(__m, __n)) {} + _LIBCPP_INLINE_VISIBILITY explicit fisher_f_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type m() const {return __p_.m();} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const fisher_f_distribution& __x, - const fisher_f_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const fisher_f_distribution& __x, - const fisher_f_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) {return !(__x == __y);} }; @@ -5209,25 +5574,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // student_t_distribution template<class _RealType = double> -class student_t_distribution +class _LIBCPP_VISIBLE student_t_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { result_type __n_; public: typedef student_t_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY explicit param_type(result_type __n = 1) : __n_(__n) {} + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __n_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__n_ == __y.__n_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; @@ -5237,31 +5606,43 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY explicit student_t_distribution(result_type __n = 1) : __p_(param_type(__n)) {} + _LIBCPP_INLINE_VISIBILITY explicit student_t_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {__nd_.reset();} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY result_type n() const {return __p_.n();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return -numeric_limits<result_type>::infinity();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return numeric_limits<result_type>::infinity();} - friend bool operator==(const student_t_distribution& __x, - const student_t_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const student_t_distribution& __x, + const student_t_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const student_t_distribution& __x, - const student_t_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const student_t_distribution& __x, + const student_t_distribution& __y) {return !(__x == __y);} }; @@ -5306,22 +5687,25 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // discrete_distribution template<class _IntType = int> -class discrete_distribution +class _LIBCPP_VISIBLE discrete_distribution { public: // types typedef _IntType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { vector<double> __p_; public: typedef discrete_distribution distribution_type; + _LIBCPP_INLINE_VISIBILITY param_type() {} template<class _InputIterator> + _LIBCPP_INLINE_VISIBILITY param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {__init();} + _LIBCPP_INLINE_VISIBILITY param_type(initializer_list<double> __wl) : __p_(__wl.begin(), __wl.end()) {__init();} template<class _UnaryOperation> @@ -5330,9 +5714,11 @@ public: vector<double> probabilities() const; - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5358,39 +5744,54 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY discrete_distribution() {} template<class _InputIterator> + _LIBCPP_INLINE_VISIBILITY discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {} + _LIBCPP_INLINE_VISIBILITY discrete_distribution(initializer_list<double> __wl) : __p_(__wl) {} template<class _UnaryOperation> + _LIBCPP_INLINE_VISIBILITY discrete_distribution(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} explicit discrete_distribution(const param_type& __p) + _LIBCPP_INLINE_VISIBILITY : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector<double> probabilities() const {return __p_.probabilities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return 0;} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__p_.size();} - friend bool operator==(const discrete_distribution& __x, - const discrete_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const discrete_distribution& __x, + const discrete_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const discrete_distribution& __x, - const discrete_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const discrete_distribution& __x, + const discrete_distribution& __y) {return !(__x == __y);} template <class _CharT, class _Traits, class _IT> @@ -5513,13 +5914,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // piecewise_constant_distribution template<class _RealType = double> -class piecewise_constant_distribution +class _LIBCPP_VISIBLE piecewise_constant_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { typedef typename common_type<double, result_type>::type __area_type; vector<result_type> __b_; @@ -5538,12 +5939,16 @@ public: param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + _LIBCPP_INLINE_VISIBILITY vector<result_type> intervals() const {return __b_;} + _LIBCPP_INLINE_VISIBILITY vector<double> densities() const {return __densities_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5569,47 +5974,63 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution() {} template<class _InputIteratorB, class _InputIteratorW> + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} template<class _UnaryOperation> + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} template<class _UnaryOperation> + _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} + _LIBCPP_INLINE_VISIBILITY explicit piecewise_constant_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector<result_type> intervals() const {return __p_.intervals();} + _LIBCPP_INLINE_VISIBILITY vector<double> densities() const {return __p_.densities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return __p_.__b_.front();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__b_.back();} - friend bool operator==(const piecewise_constant_distribution& __x, - const piecewise_constant_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const piecewise_constant_distribution& __x, + const piecewise_constant_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const piecewise_constant_distribution& __x, + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {return !(__x == __y);} @@ -5794,13 +6215,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, // piecewise_linear_distribution template<class _RealType = double> -class piecewise_linear_distribution +class _LIBCPP_VISIBLE piecewise_linear_distribution { public: // types typedef _RealType result_type; - class param_type + class _LIBCPP_VISIBLE param_type { typedef typename common_type<double, result_type>::type __area_type; vector<result_type> __b_; @@ -5819,12 +6240,16 @@ public: param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); + _LIBCPP_INLINE_VISIBILITY vector<result_type> intervals() const {return __b_;} + _LIBCPP_INLINE_VISIBILITY vector<double> densities() const {return __densities_;} - friend bool operator==(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const param_type& __x, const param_type& __y) {return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;} - friend bool operator!=(const param_type& __x, const param_type& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} private: @@ -5850,48 +6275,64 @@ private: public: // constructor and reset functions + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution() {} template<class _InputIteratorB, class _InputIteratorW> + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} template<class _UnaryOperation> + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(initializer_list<result_type> __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} template<class _UnaryOperation> + _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw) : __p_(__nw, __xmin, __xmax, __fw) {} + _LIBCPP_INLINE_VISIBILITY explicit piecewise_linear_distribution(const param_type& __p) : __p_(__p) {} + _LIBCPP_INLINE_VISIBILITY void reset() {} // generating functions - template<class _URNG> result_type operator()(_URNG& __g) + template<class _URNG> + _LIBCPP_INLINE_VISIBILITY + result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); // property functions + _LIBCPP_INLINE_VISIBILITY vector<result_type> intervals() const {return __p_.intervals();} + _LIBCPP_INLINE_VISIBILITY vector<double> densities() const {return __p_.densities();} + _LIBCPP_INLINE_VISIBILITY param_type param() const {return __p_;} + _LIBCPP_INLINE_VISIBILITY void param(const param_type& __p) {__p_ = __p;} + _LIBCPP_INLINE_VISIBILITY result_type min() const {return __p_.__b_.front();} + _LIBCPP_INLINE_VISIBILITY result_type max() const {return __p_.__b_.back();} - friend bool operator==(const piecewise_linear_distribution& __x, - const piecewise_linear_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(const piecewise_linear_distribution& __x, + const piecewise_linear_distribution& __y) {return __x.__p_ == __y.__p_;} - friend bool operator!=(const piecewise_linear_distribution& __x, - const piecewise_linear_distribution& __y) + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(const piecewise_linear_distribution& __x, + const piecewise_linear_distribution& __y) {return !(__x == __y);} template <class _CharT, class _Traits, class _RT> |