diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e60f053aaa7..e5c79e80151 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,92 @@ +2009-04-09 Paolo Carlini + + PR libstdc++/39629 (final bits) + * include/bits/random.h (subtract_with_carry_engine<>::_S_modulus): + Remove, consistently use __detail::_Shift<_UIntType, __w>::__value. + * include/bits/random.tcc (shuffle_order_engine<>::operator()()): + Fix formula for __j. + * include/bits/random.tcc (operator==(const normal_distribution<>&, + const normal_distribution<>&): Remove. + * include/bits/random.h (operator==(const uniform_int_distribution<>&, + const uniform_int_distribution<>&), operator==(const + uniform_real_distribution<>&, const uniform_real_distribution<>&), + operator==(const normal_distribution<>&, const normal_distribution<>&), + operator==(const lognormal_distribution<>&, + const lognormal_distribution<>&), operator==(const + chi_squared_distribution<>&, const chi_squared_distribution<>&), + operator==(const cauchy_distribution<>&, const cauchy_distribution<>&), + operator==(const fisher_distribution<>&, const fisher_distribution<>&), + operator==(const student_t_distribution<>&, + const student_t_distribution<>&), operator==(const + bernoulli_distribution<>&, const bernoulli_distribution<>&), + operator==(const binomial_distribution<>&, const + binomial_distribution<>&), operator==(const geometric_distribution<>&, + const geometric_distribution<>&), operator==(const + negative_binomial_distribution<>&, const + negative_binomial_distribution<>&), operator==(const + poisson_distribution<>&, const poisson_distribution<>&), + operator==(const exponential_distribution<>&, + const exponential_distribution<>&), operator==(const + gamma_distribution<>&, const gamma_distribution<>&), operator==(const + weibull_distribution<>&, const weibull_distribution<>&), + operator==(const extreme_value_distribution<>&, + const extreme_value_distribution<>&), operator==(const + discrete_distribution<>&, const discrete_distribution<>&), + operator==(const piecewise_constant_distribution<>&, + const piecewise_constant_distribution<>&), operator==(const + piecewise_linear_distribution<>&, const + piecewise_linear_distribution<>&)): Remove. + * testsuite/26_numerics/random/uniform_real_distribution/operators/ + serialize.cc: Remove. + * testsuite/26_numerics/random/piecewise_constant_distribution/ + operators/serialize.cc: Likewise. + * testsuite/26_numerics/random/chi_squared_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/normal_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/uniform_int_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/poisson_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/bernoulli_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/discrete_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/weibull_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/negative_binomial_distribution/ + operators/serialize.cc: Likewise. + * testsuite/26_numerics/random/cauchy_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/gamma_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/fisher_f_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/exponential_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/lognormal_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/binomial_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/extreme_value_distribution/ + operators/serialize.cc: Likewise. + * testsuite/26_numerics/random/piecewise_linear_distribution/ + operators/serialize.cc: Likewise. + * testsuite/26_numerics/random/student_t_distribution/operators/ + serialize.cc: Likewise. + * testsuite/26_numerics/random/geometric_distribution/operators/ + serialize.cc: Likewise. + + * include/bits/random.h (linear_congruential_engine<>::seed(_Gen&, + true_type), linear_congruential_engine<>::seed(_Gen&, false_type), + mersenne_twister_engine<>::seed(_Gen&, + true_type), mersenne_twister_engine<>::seed(_Gen&, false_type), + subtract_with_carry_engine<>::seed(_Gen&, + true_type), subtract_with_carry_engine<>::seed(_Gen&, false_type)): + Remove, unused. + * include/bits/random.tcc (linear_congruential_engine<>:: + seed(_Gen&, false_type): Likewise. + 2009-04-09 Nick Clifton * src/allocator-inst.cc: Change copyright header to refer to diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index d9e3148b0a1..366105caa8f 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -70,8 +70,8 @@ namespace std // XXX need constexpr template - (std::numeric_limits<_UIntType>::digits)> + bool = __w < static_cast + (std::numeric_limits<_UIntType>::digits)> struct _ShiftMin1 { static const _UIntType __value = @@ -206,7 +206,7 @@ namespace std static const result_type increment = __c; /** The modulus. */ static const result_type modulus = __m; - static const result_type default_seed = 1UL; + static const result_type default_seed = 1u; /** * @brief Constructs a %linear_congruential_engine random number @@ -258,7 +258,7 @@ namespace std */ result_type min() const - { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; } + { return __c == 0u ? 1u : 0u; } /** * @brief Gets the largest possible value in the output range. @@ -267,7 +267,7 @@ namespace std */ result_type max() const - { return __m - 1; } + { return __m - 1u; } /** * @brief Discard a sequence of random numbers. @@ -340,15 +340,6 @@ namespace std __c1, __m1>&); private: - template - void - seed(_Gen& __g, true_type) - { return seed(static_cast(__g)); } - - template - void - seed(_Gen& __g, false_type); - _UIntType _M_x; }; @@ -429,7 +420,7 @@ namespace std static const result_type tempering_c = __c; static const size_t tempering_l = __l; static const size_t initialization_multiplier = __f; - static const result_type default_seed = 5489UL; + static const result_type default_seed = 5489u; // constructors and member function explicit @@ -554,15 +545,6 @@ namespace std __l1, __f1>&); private: - template - void - seed(_Gen& __g, true_type) - { return seed(static_cast(__g)); } - - template - void - seed(_Gen& __g, false_type); - _UIntType _M_x[state_size]; size_t _M_p; }; @@ -602,7 +584,7 @@ namespace std static const size_t word_size = __w; static const size_t short_lag = __s; static const size_t long_lag = __r; - static const result_type default_seed = 19780503; + static const result_type default_seed = 19780503u; /** * @brief Constructs an explicitly seeded % subtract_with_carry_engine @@ -662,7 +644,7 @@ namespace std */ result_type max() const - { return _S_modulus - 1U; } + { return __detail::_ShiftMin1<_UIntType, __w>::__value; } /** * @brief Discard a sequence of random numbers. @@ -736,18 +718,6 @@ namespace std __s1, __r1>&); private: - template - void - seed(_Gen& __g, true_type) - { return seed(static_cast(__g)); } - - template - void - seed(_Gen& __g, false_type); - - static const size_t _S_modulus - = __detail::_Shift<_UIntType, __w>::__value; - _UIntType _M_x[long_lag]; _UIntType _M_carry; size_t _M_p; @@ -1564,10 +1534,6 @@ namespace std b() const { return _M_b; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); } - private: _IntType _M_a; _IntType _M_b; @@ -1681,16 +1647,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two uniform integer distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::uniform_int_distribution<_IntType>& __d1, - const std::uniform_int_distribution<_IntType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %uniform_int_distribution random number * distribution @p __x into the output stream @p os. @@ -1755,10 +1711,6 @@ namespace std b() const { return _M_b; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); } - private: _RealType _M_a; _RealType _M_b; @@ -1850,16 +1802,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two uniform real distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::uniform_real_distribution<_IntType>& __d1, - const std::uniform_real_distribution<_IntType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %uniform_real_distribution random number * distribution @p __x into the output stream @p __os. @@ -1931,11 +1873,6 @@ namespace std stddev() const { return _M_stddev; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_mean == __p2._M_mean) - && (__p1._M_stddev == __p2._M_stddev); } - private: _RealType _M_mean; _RealType _M_stddev; @@ -2017,15 +1954,6 @@ namespace std operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); - /** - * @brief Return true if two normal distributions have - * the same parameters. - */ - template - friend bool - operator==(const std::normal_distribution<_RealType1>& __d1, - const std::normal_distribution<_RealType1>& __d2); - /** * @brief Inserts a %normal_distribution random number distribution * @p __x into the output stream @p __os. @@ -2095,10 +2023,6 @@ namespace std s() const { return _M_s; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_m == __p2._M_m) && (__p1._M_s == __p2._M_s); } - private: _RealType _M_m; _RealType _M_s; @@ -2176,16 +2100,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two lognormal distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::lognormal_distribution<_RealType>& __d1, - const std::lognormal_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %lognormal_distribution random number distribution * @p __x into the output stream @p __os. @@ -2243,10 +2157,6 @@ namespace std n() const { return _M_n; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_n == __p2._M_n; } - private: _RealType _M_n; }; @@ -2318,16 +2228,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Chi-squared distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::chi_squared_distribution<_RealType>& __d1, - const std::chi_squared_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %chi_squared_distribution random number distribution * @p __x into the output stream @p __os. @@ -2390,10 +2290,6 @@ namespace std b() const { return _M_b; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); } - private: _RealType _M_a; _RealType _M_b; @@ -2471,16 +2367,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Cauchy distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::cauchy_distribution<_RealType>& __d1, - const std::cauchy_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %cauchy_distribution random number distribution * @p __x into the output stream @p __os. @@ -2545,10 +2431,6 @@ namespace std n() const { return _M_n; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_m == __p2._M_m) && (__p1._M_n == __p2._M_n); } - private: _RealType _M_m; _RealType _M_n; @@ -2626,16 +2508,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Fisher f distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::fisher_f_distribution<_RealType>& __d1, - const std::fisher_f_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %fisher_f_distribution random number distribution * @p __x into the output stream @p __os. @@ -2694,10 +2566,6 @@ namespace std n() const { return _M_n; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_n == __p2._M_n; } - private: _RealType _M_n; }; @@ -2774,16 +2642,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Student t distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::student_t_distribution<_RealType>& __d1, - const std::student_t_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %student_t_distribution random number distribution * @p __x into the output stream @p __os. @@ -2849,10 +2707,6 @@ namespace std p() const { return _M_p; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_p == __p2._M_p; } - private: double _M_p; }; @@ -2950,15 +2804,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Bernoulli distributions have - * the same parameters. - */ - inline bool - operator==(const std::bernoulli_distribution& __d1, - const std::bernoulli_distribution& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %bernoulli_distribution random number distribution * @p __x into the output stream @p __os. @@ -3034,10 +2879,6 @@ namespace std p() const { return _M_p; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_t == __p2._M_t) && (__p1._M_p == __p2._M_p); } - private: void _M_initialize(); @@ -3115,17 +2956,6 @@ namespace std max() const { return _M_param.t(); } - /** - * @brief Return true if two binomial distributions have - * the same parameters. - */ - template - friend bool - operator==(const std::binomial_distribution<_IntType1>& __d1, - const std::binomial_distribution<_IntType1>& __d2) - { return ((__d1.param() == __d2.param()) - && (__d1._M_nd == __d2._M_nd)); } - template result_type operator()(_UniformRandomNumberGenerator& __urng) @@ -3214,10 +3044,6 @@ namespace std p() const { return _M_p; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_p == __p2._M_p; } - private: void _M_initialize() @@ -3297,16 +3123,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two geometric distributions have - * the same parameters. - */ - template - inline bool - operator==(const geometric_distribution<_IntType>& __d1, - const geometric_distribution<_IntType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %geometric_distribution random number distribution * @p __x into the output stream @p __os. @@ -3372,10 +3188,6 @@ namespace std p() const { return _M_p; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_k == __p2._M_k) && (__p1._M_p == __p2._M_p); } - private: _IntType _M_k; double _M_p; @@ -3455,16 +3267,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two negative binomial distributions have - * the same parameters. - */ - template - inline bool - operator==(const std::negative_binomial_distribution<_IntType>& __d1, - const std::negative_binomial_distribution<_IntType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %negative_binomial_distribution random * number distribution @p __x into the output stream @p __os. @@ -3537,10 +3339,6 @@ namespace std mean() const { return _M_mean; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_mean == __p2._M_mean; } - private: // Hosts either log(mean) or the threshold of the simple method. void @@ -3618,17 +3416,6 @@ namespace std operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); - /** - * @brief Return true if two Poisson distributions have the same - * parameters. - */ - template - friend bool - operator==(const std::poisson_distribution<_IntType1>& __d1, - const std::poisson_distribution<_IntType1>& __d2) - { return ((__d1.param() == __d2.param()) - && (__d1._M_nd == __d2._M_nd)); } - /** * @brief Inserts a %poisson_distribution random number distribution * @p __x into the output stream @p __os. @@ -3703,10 +3490,6 @@ namespace std lambda() const { return _M_lambda; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_lambda == __p2._M_lambda; } - private: _RealType _M_lambda; }; @@ -3793,16 +3576,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two exponential distributions have the same - * parameters. - */ - template - inline bool - operator==(const std::exponential_distribution<_RealType>& __d1, - const std::exponential_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %exponential_distribution random number distribution * @p __x into the output stream @p __os. @@ -3870,11 +3643,6 @@ namespace std beta() const { return _M_beta; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return ((__p1._M_alpha == __p2._M_alpha) - && (__p1._M_beta == __p2._M_beta)); } - private: void _M_initialize(); @@ -3967,16 +3735,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two gamma distributions have the same - * parameters. - */ - template - inline bool - operator==(const std::gamma_distribution<_RealType>& __d1, - const std::gamma_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %gamma_distribution random number distribution * @p __x into the output stream @p __os. @@ -4039,10 +3797,6 @@ namespace std b() const { return _M_b; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); } - private: _RealType _M_a; _RealType _M_b; @@ -4129,16 +3883,6 @@ namespace std param_type _M_param; }; - /** - * @brief Return true if two Weibull distributions have the same - * parameters. - */ - template - inline bool - operator==(const std::weibull_distribution<_RealType>& __d1, - const std::weibull_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %weibull_distribution random number distribution * @p __x into the output stream @p __os. @@ -4202,10 +3946,6 @@ namespace std b() const { return _M_b; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); } - private: _RealType _M_a; _RealType _M_b; @@ -4286,15 +4026,6 @@ namespace std param_type _M_param; }; - /** - * - */ - template - inline bool - operator==(const std::extreme_value_distribution<_RealType>& __d1, - const std::extreme_value_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief Inserts a %extreme_value_distribution random number distribution * @p __x into the output stream @p __os. @@ -4368,10 +4099,6 @@ namespace std probabilities() const { return _M_prob; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_prob == __p2._M_prob; } - private: void _M_initialize(); @@ -4493,15 +4220,6 @@ namespace std param_type _M_param; }; - /** - * - */ - template - inline bool - operator==(const std::discrete_distribution<_IntType>& __d1, - const std::discrete_distribution<_IntType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief A piecewise_constant_distribution random number distribution. @@ -4543,11 +4261,6 @@ namespace std densities() const { return _M_den; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return ((__p1._M_int == __p2._M_int) - && (__p1._M_den == __p2._M_den)); } - private: void _M_initialize(); @@ -4683,15 +4396,6 @@ namespace std param_type _M_param; }; - /** - * - */ - template - inline bool - operator==(const std::piecewise_constant_distribution<_RealType>& __d1, - const std::piecewise_constant_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } - /** * @brief A piecewise_linear_distribution random number distribution. @@ -4733,11 +4437,6 @@ namespace std densities() const { return _M_den; } - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return ((__p1._M_int == __p2._M_int) - && (__p1._M_den == __p2._M_den)); } - private: void _M_initialize(); @@ -4875,14 +4574,6 @@ namespace std param_type _M_param; }; - /** - * - */ - template - inline bool - operator==(const std::piecewise_linear_distribution<_RealType>& __d1, - const std::piecewise_linear_distribution<_RealType>& __d2) - { return __d1.param() == __d2.param(); } /* @} */ // group std_random_distributions_poisson diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 1511e745dff..9fed72ff881 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -90,23 +90,23 @@ namespace std } // namespace __detail /** - * Seeds the LCR with integral value @p __x0, adjusted so that the + * Seeds the LCR with integral value @p __s, adjusted so that the * ring identity is never a member of the convergence set. */ template void linear_congruential_engine<_UIntType, __a, __c, __m>:: - seed(_UIntType __x0) + seed(result_type __s) { if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U) - && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U)) + && (__detail::__mod<_UIntType, 1U, 0U, __m>(__s) == 0U)) _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U); else - _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0); + _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__s); } /** - * Seeds the LCR engine with a value generated by @p __g. + * Seeds the LCR engine with a value generated by @p __q. */ template void @@ -117,39 +117,17 @@ namespace std : std::__lg(__m); const _UIntType __k = (__k0 + 31) / 32; _UIntType __arr[__k + 3]; - __q.generate(__arr + 0, __arr + 3); + __q.generate(__arr + 0, __arr + __k + 3); _UIntType __factor = 1U; _UIntType __sum = 0U; - for (size_t __i = 0; __i < __k; ++__i) + for (size_t __j = 0; __j < __k; ++__j) { - __sum += __arr[__i + 3] * __factor; + __sum += __arr[__j + 3] * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } - - if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U) - && (__detail::__mod<_UIntType, 1U, 0U, __m>(__sum) == 0U)) - _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U); - else - _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__sum); + seed(__sum); } - /** - * Seeds the LCR engine with a value generated by @p __g. - */ - template - template - void - linear_congruential_engine<_UIntType, __a, __c, __m>:: - seed(_Gen& __g, false_type) - { - _UIntType __x0 = __g(); - if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U) - && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U)) - _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U); - else - _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0); - } - /** * Gets the next generated value in sequence. */ @@ -399,7 +377,8 @@ namespace std (__lcg()) * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } - _M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, + __detail::_Shift<_UIntType, __w>::__value>(__sum); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; @@ -411,7 +390,7 @@ namespace std seed(seed_seq& __q) { const size_t __n = (word_size + 31) / 32; - unsigned int __arr[long_lag + __n]; + _UIntType __arr[long_lag + __n]; __q.generate(__arr + 0, __arr + long_lag + __n); for (size_t __i = 0; __i < long_lag; ++__i) @@ -424,7 +403,8 @@ namespace std (__arr[__i * __n + __j]) * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } - _M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, + __detail::_Shift<_UIntType, __w>::__value>(__sum); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; @@ -452,7 +432,8 @@ namespace std } else { - __xi = _S_modulus - _M_x[_M_p] - _M_carry + _M_x[__ps]; + __xi = (__detail::_Shift<_UIntType, __w>::__value + - _M_x[_M_p] - _M_carry + _M_x[__ps]); _M_carry = 1; } _M_x[_M_p] = __xi; @@ -619,8 +600,8 @@ namespace std shuffle_order_engine<_RandomNumberEngine, __k>:: operator()() { - size_t __j = (__k * (_M_y - _M_b.min())) - / (_M_b.max() - _M_b.min() + 1); + size_t __j = __k * ((_M_y - _M_b.min()) + / (_M_b.max() - _M_b.min() + 1.0L)); _M_y = _M_v[__j]; _M_v[__j] = _M_b(); @@ -1437,30 +1418,6 @@ namespace std } - template - bool - operator==(const normal_distribution<_RealType>& __d1, - const normal_distribution<_RealType>& __d2) - { - if (__d1._M_param == __d2._M_param) - { - if (__d1._M_saved_available == __d2._M_saved_available) - { - if (__d1._M_saved_available - && __d1._M_saved == __d2._M_saved) - return true; - else if(!__d1._M_saved_available) - return true; - else - return false; - } - else - return false; - } - else - return false; - } - /** * Polar method due to Marsaglia. * diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc deleted file mode 100644 index c78427cba7f..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::bernoulli_distribution u(0.75), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc deleted file mode 100644 index ae956ba117e..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::binomial_distribution u(3, 0.75), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc deleted file mode 100644 index 887907ad298..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] -// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::cauchy_distribution u(5.0, 2.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc deleted file mode 100644 index e48f42b4fd3..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::chi_squared_distribution u(1.5), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc deleted file mode 100644 index 1dbd5706a46..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc +++ /dev/null @@ -1,52 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; - std::discrete_distribution u(wt.begin(), wt.end()), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc deleted file mode 100644 index 78c3e9d5a17..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::exponential_distribution u(0.5), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc deleted file mode 100644 index bf976b0d8f0..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::extreme_value_distribution u, v(5.0, 2.0); - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc deleted file mode 100644 index 8d53756c36e..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::fisher_f_distribution u(2.0, 3.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc deleted file mode 100644 index f7035df03f9..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::gamma_distribution u(1.5, 3.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc deleted file mode 100644 index 907e59ecc22..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geom] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::geometric_distribution u(0.75), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc deleted file mode 100644 index acee3c0d9ce..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::lognormal_distribution u(5.0, 2.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc deleted file mode 100644 index dce6a89ecb8..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::negative_binomial_distribution u(3, 0.75), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc deleted file mode 100644 index 865aa4566a1..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::normal_distribution u(5.0, 2.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc deleted file mode 100644 index fc1f15703c1..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc +++ /dev/null @@ -1,54 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; - std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; - std::piecewise_constant_distribution - u(x.begin(), x.end(), wt.begin()), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc deleted file mode 100644 index fa846dc634e..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc +++ /dev/null @@ -1,57 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - - typedef double value_type; - typedef std::piecewise_linear_distribution distribution_type; - std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; - std::vector wt = {0.0, 1.0, 2.5, 1.5, 0.5, 0.0}; - distribution_type u(x.begin(), x.end(), wt.begin()); - distribution_type v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc deleted file mode 100644 index bd4c83973b2..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::poisson_distribution u(5.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc deleted file mode 100644 index a5bbf299c96..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::student_t_distribution u(1.5), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc deleted file mode 100644 index 5a100f1c07d..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::uniform_int_distribution u(1, 20), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc deleted file mode 100644 index d3b99356dc7..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::uniform_real_distribution u(-5.0, 5.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc deleted file mode 100644 index d6b5116452a..00000000000 --- a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc +++ /dev/null @@ -1,51 +0,0 @@ -// { dg-options "-std=c++0x" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] -// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] - -#include -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::stringstream str; - std::weibull_distribution u(2.0, 3.5), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - VERIFY( !(u == v) ); - - str >> v; - VERIFY( u == v ); -} - -int main() -{ - test01(); - return 0; -}