diff options
Diffstat (limited to '3rdParty/Boost/src/boost/random')
17 files changed, 92 insertions, 89 deletions
diff --git a/3rdParty/Boost/src/boost/random/detail/config.hpp b/3rdParty/Boost/src/boost/random/detail/config.hpp index d6bc0cc..724ab19 100644 --- a/3rdParty/Boost/src/boost/random/detail/config.hpp +++ b/3rdParty/Boost/src/boost/random/detail/config.hpp @@ -1,18 +1,18 @@ /* boost random/detail/config.hpp header file * * Copyright Steven Watanabe 2009 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: config.hpp 52492 2009-04-19 14:55:57Z steven_watanabe $ + * $Id$ */ #include <boost/config.hpp> #if (defined(BOOST_NO_OPERATORS_IN_NAMESPACE) || defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)) \ && !defined(BOOST_MSVC) #define BOOST_RANDOM_NO_STREAM_OPERATORS #endif diff --git a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp index 9778f55..07f4ea7 100644 --- a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp +++ b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp @@ -1,45 +1,45 @@ /* boost random/detail/const_mod.hpp header file * * Copyright Jens Maurer 2000-2001 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: const_mod.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-02-18 moved to individual header files */ #ifndef BOOST_RANDOM_CONST_MOD_HPP #define BOOST_RANDOM_CONST_MOD_HPP #include <boost/assert.hpp> #include <boost/static_assert.hpp> #include <boost/integer_traits.hpp> #include <boost/type_traits/make_unsigned.hpp> #include <boost/random/detail/large_arithmetic.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { template<class IntType, IntType m> class const_mod { public: static IntType apply(IntType x) { if(((unsigned_m() - 1) & unsigned_m()) == 0) return (unsigned_type(x)) & (unsigned_m() - 1); else { IntType supress_warnings = (m == 0); BOOST_ASSERT(supress_warnings == 0); return x % (m + supress_warnings); } } static IntType add(IntType x, IntType c) diff --git a/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp b/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp index f3ade5e..d875004 100644 --- a/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp +++ b/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp @@ -1,23 +1,28 @@ /* boost random/detail/disable_warnings.hpp header file * * Copyright Steven Watanabe 2009 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: disable_warnings.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id$ * */ // No #include guard. This header is intended to be included multiple times. #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4512) #pragma warning(disable:4127) #pragma warning(disable:4724) #endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp b/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp index 26184ea..24f3bb3 100644 --- a/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp +++ b/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp @@ -1,18 +1,22 @@ /* boost random/detail/enable_warnings.hpp header file * * Copyright Steven Watanabe 2009 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: enable_warnings.hpp 58649 2010-01-02 21:23:17Z steven_watanabe $ + * $Id$ * */ // No #include guard. This header is intended to be included multiple times. #ifdef BOOST_MSVC #pragma warning(pop) #endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 +#pragma GCC diagnostic pop +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp index 44b4248..0527614 100644 --- a/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp +++ b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp @@ -1,36 +1,36 @@ /* boost random/detail/generator_bits.hpp header file * * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: generator_bits.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ * */ #ifndef BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP #define BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP #include <boost/limits.hpp> namespace boost { namespace random { namespace detail { // This is a temporary measure that retains backwards // compatibility. template<class URNG> struct generator_bits { static std::size_t value() { return std::numeric_limits<typename URNG::result_type>::digits; } }; } // namespace detail } // namespace random } // namespace boost #endif // BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp index 6aaf98f..7e13483 100644 --- a/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp +++ b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp @@ -1,40 +1,40 @@ /* boost random/mersenne_twister.hpp header file * * Copyright Jens Maurer 2000-2001 * Copyright Steven Watanabe 2010 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: generator_seed_seq.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * */ #ifndef BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED #define BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED namespace boost { namespace random { namespace detail { template<class Generator> class generator_seed_seq { public: generator_seed_seq(Generator& g) : gen(&g) {} template<class It> void generate(It first, It last) { for(; first != last; ++first) { *first = (*gen)(); } } private: Generator* gen; }; } } } #endif diff --git a/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp index baee426..248243a 100644 --- a/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp +++ b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp @@ -1,73 +1,73 @@ /* boost random/detail/integer_log2.hpp header file * * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: integer_log2.hpp 76145 2011-12-24 19:05:17Z danieljames $ + * $Id$ * */ #ifndef BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP #define BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP #include <boost/config.hpp> #include <boost/limits.hpp> #include <boost/pending/integer_log2.hpp> namespace boost { namespace random { namespace detail { -#if !defined(BOOST_NO_CONSTEXPR) +#if !defined(BOOST_NO_CXX11_CONSTEXPR) #define BOOST_RANDOM_DETAIL_CONSTEXPR constexpr #elif defined(BOOST_MSVC) #define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline #elif defined(__GNUC__) && __GNUC__ >= 4 -#define BOOST_RANDOM_DETAIL_CONSTEXPR __attribute__((const)) __attribute__((always_inline)) +#define BOOST_RANDOM_DETAIL_CONSTEXPR inline __attribute__((__const__)) __attribute__((__always_inline__)) #else #define BOOST_RANDOM_DETAIL_CONSTEXPR inline #endif template<int Shift> struct integer_log2_impl { -#if defined(BOOST_NO_CONSTEXPR) +#if defined(BOOST_NO_CXX11_CONSTEXPR) template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) { int update = ((t >> Shift) != 0) * Shift; return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update); } #else template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR static int apply2(T t, int accum, int update) { return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update); } template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) { return apply2(t, accum, ((t >> Shift) != 0) * Shift); } #endif }; template<> struct integer_log2_impl<1> { template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) { return int(t >> 1) + accum; } }; template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t) { return integer_log2_impl< diff --git a/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp index 24177dc..66f6b4e 100644 --- a/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp +++ b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp @@ -1,122 +1,122 @@ /* boost random/detail/large_arithmetic.hpp header file * * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: large_arithmetic.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP #define BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP #include <boost/cstdint.hpp> #include <boost/integer.hpp> #include <boost/limits.hpp> #include <boost/random/detail/integer_log2.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { namespace detail { struct div_t { boost::uintmax_t quotient; boost::uintmax_t remainder; }; inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) { - static const int bits = + const int bits = ::std::numeric_limits< ::boost::uintmax_t>::digits / 2; - static const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1; + const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1; typedef ::boost::uint_t<bits>::fast digit_t; int shift = std::numeric_limits< ::boost::uintmax_t>::digits - 1 - detail::integer_log2(m); a <<= shift; m <<= shift; digit_t product[4] = { 0, 0, 0, 0 }; digit_t a_[2] = { digit_t(a & mask), digit_t((a >> bits) & mask) }; digit_t b_[2] = { digit_t(b & mask), digit_t((b >> bits) & mask) }; digit_t m_[2] = { digit_t(m & mask), digit_t((m >> bits) & mask) }; // multiply a * b for(int i = 0; i < 2; ++i) { digit_t carry = 0; for(int j = 0; j < 2; ++j) { ::boost::uint64_t temp = ::boost::uintmax_t(a_[i]) * b_[j] + carry + product[i + j]; product[i + j] = digit_t(temp & mask); carry = digit_t(temp >> bits); } if(carry != 0) { product[i + 2] += carry; } } digit_t quotient[2]; if(m == 0) { div_t result = { ((::boost::uintmax_t(product[3]) << bits) | product[2]), ((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift, }; return result; } // divide product / m for(int i = 3; i >= 2; --i) { ::boost::uintmax_t temp = ::boost::uintmax_t(product[i]) << bits | product[i - 1]; digit_t q = digit_t((product[i] == m_[1]) ? mask : temp / m_[1]); ::boost::uintmax_t rem = ((temp - ::boost::uintmax_t(q) * m_[1]) << bits) + product[i - 2]; ::boost::uintmax_t diff = m_[0] * ::boost::uintmax_t(q); int error = 0; if(diff > rem) { if(diff - rem > m) { error = 2; } else { error = 1; } } q -= error; rem = rem + error * m - diff; quotient[i - 2] = q; product[i] = 0; - product[i-1] = (rem >> bits) & mask; - product[i-2] = rem & mask; + product[i-1] = static_cast<digit_t>((rem >> bits) & mask); + product[i-2] = static_cast<digit_t>(rem & mask); } div_t result = { ((::boost::uintmax_t(quotient[1]) << bits) | quotient[0]), ((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift, }; return result; } inline boost::uintmax_t muldiv(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) { return detail::muldivmod(a, b, m).quotient; } inline boost::uintmax_t mulmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) { return detail::muldivmod(a, b, m).remainder; } } // namespace detail } // namespace random } // namespace boost #include <boost/random/detail/enable_warnings.hpp> #endif // BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/operators.hpp b/3rdParty/Boost/src/boost/random/detail/operators.hpp index f27839a..597343c 100644 --- a/3rdParty/Boost/src/boost/random/detail/operators.hpp +++ b/3rdParty/Boost/src/boost/random/detail/operators.hpp @@ -1,45 +1,45 @@ /* boost random/detail/operators.hpp header file * * Copyright Steven Watanabe 2010-2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: operators.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP #define BOOST_RANDOM_DETAIL_OPERATORS_HPP #include <boost/random/detail/config.hpp> #include <boost/detail/workaround.hpp> #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) \ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \ template<class CharT, class Traits> \ friend std::basic_ostream<CharT,Traits>& \ operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) { \ t.print(os, t); \ return os; \ } \ template<class CharT, class Traits> \ static std::basic_ostream<CharT,Traits>& \ print(std::basic_ostream<CharT,Traits>& os, const T& t) #define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \ template<class CharT, class Traits> \ friend std::basic_istream<CharT,Traits>& \ operator>>(std::basic_istream<CharT,Traits>& is, T& t) { \ t.read(is, t); \ return is; \ } \ template<class CharT, class Traits> \ static std::basic_istream<CharT,Traits>& \ read(std::basic_istream<CharT,Traits>& is, T& t) #endif diff --git a/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp b/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp index 3f3fbdd..f1b983d 100644 --- a/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp +++ b/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp @@ -1,94 +1,67 @@ /* boost random/detail/ptr_helper.hpp header file * * Copyright Jens Maurer 2002 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: ptr_helper.hpp 24096 2004-07-27 03:43:34Z dgregor $ + * $Id$ * */ #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP #include <boost/config.hpp> namespace boost { namespace random { namespace detail { // type_traits could help here, but I don't want to depend on type_traits. template<class T> struct ptr_helper { typedef T value_type; typedef T& reference_type; typedef const T& rvalue_type; static reference_type ref(T& r) { return r; } static const T& ref(const T& r) { return r; } }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template<class T> struct ptr_helper<T&> { typedef T value_type; typedef T& reference_type; typedef T& rvalue_type; static reference_type ref(T& r) { return r; } static const T& ref(const T& r) { return r; } }; template<class T> struct ptr_helper<T*> { typedef T value_type; typedef T& reference_type; typedef T* rvalue_type; static reference_type ref(T * p) { return *p; } static const T& ref(const T * p) { return *p; } }; -#endif } // namespace detail } // namespace random } // namespace boost // // BOOST_RANDOM_PTR_HELPER_SPEC -- // // Helper macro for broken compilers defines specializations of // ptr_helper. // -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# define BOOST_RANDOM_PTR_HELPER_SPEC(T) \ -namespace boost { namespace random { namespace detail { \ -template<> \ -struct ptr_helper<T&> \ -{ \ - typedef T value_type; \ - typedef T& reference_type; \ - typedef T& rvalue_type; \ - static reference_type ref(T& r) { return r; } \ - static const T& ref(const T& r) { return r; } \ -}; \ - \ -template<> \ -struct ptr_helper<T*> \ -{ \ - typedef T value_type; \ - typedef T& reference_type; \ - typedef T* rvalue_type; \ - static reference_type ref(T * p) { return *p; } \ - static const T& ref(const T * p) { return *p; } \ -}; \ -}}} -#else # define BOOST_RANDOM_PTR_HELPER_SPEC(T) -#endif #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/seed.hpp b/3rdParty/Boost/src/boost/random/detail/seed.hpp index 979db29..55b2fa6 100644 --- a/3rdParty/Boost/src/boost/random/detail/seed.hpp +++ b/3rdParty/Boost/src/boost/random/detail/seed.hpp @@ -1,45 +1,45 @@ /* boost random/detail/seed.hpp header file * * Copyright Steven Watanabe 2009 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: seed.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_SEED_HPP #define BOOST_RANDOM_DETAIL_SEED_HPP #include <boost/config.hpp> // Sun seems to have trouble with the use of SFINAE for the // templated constructor. So does Borland. #if !defined(BOOST_NO_SFINAE) && !defined(__SUNPRO_CC) && !defined(__BORLANDC__) #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_arithmetic.hpp> namespace boost { namespace random { namespace detail { template<class T> struct disable_seed : boost::disable_if<boost::is_arithmetic<T> > {}; template<class Engine, class T> struct disable_constructor : disable_seed<T> {}; template<class Engine> struct disable_constructor<Engine, Engine> {}; #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \ template<class Generator> \ explicit Self(Generator& gen, typename ::boost::random::detail::disable_constructor<Self, Generator>::type* = 0) #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen) \ template<class Generator> \ void seed(Generator& gen, typename ::boost::random::detail::disable_seed<Generator>::type* = 0) diff --git a/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp index e044d45..f88cab2 100644 --- a/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp +++ b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp @@ -1,52 +1,53 @@ /* boost random/detail/seed.hpp header file * * Copyright Steven Watanabe 2009 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: seed_impl.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_SEED_IMPL_HPP #define BOOST_RANDOM_DETAIL_SEED_IMPL_HPP #include <stdexcept> #include <boost/cstdint.hpp> +#include <boost/throw_exception.hpp> #include <boost/config/no_tr1/cmath.hpp> #include <boost/integer/integer_mask.hpp> #include <boost/integer/static_log2.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/make_unsigned.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/int.hpp> #include <boost/random/detail/const_mod.hpp> #include <boost/random/detail/integer_log2.hpp> #include <boost/random/detail/signed_unsigned_tools.hpp> #include <boost/random/detail/generator_bits.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { namespace detail { // finds the seed type of an engine, given its // result_type. If the result_type is integral // the seed type is the same. If the result_type // is floating point, the seed type is uint32_t template<class T> struct seed_type { typedef typename boost::mpl::if_<boost::is_integral<T>, T, boost::uint32_t >::type type; }; template<int N> struct const_pow_impl @@ -221,177 +222,177 @@ void generate(Engine& eng, Iter first, Iter last) return detail::generate_impl(eng, first, last, boost::is_integral<typename Engine::result_type>()); } template<class IntType, IntType m, class SeedSeq> IntType seed_one_int(SeedSeq& seq) { static const int log = ::boost::mpl::if_c<(m == 0), ::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>, ::boost::static_log2<m> >::type::value; static const int k = (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32; ::boost::uint_least32_t array[log / 32 + 4]; seq.generate(&array[0], &array[0] + k + 3); IntType s = 0; for(int j = 0; j < k; ++j) { IntType digit = const_mod<IntType, m>::apply(IntType(array[j+3])); IntType mult = IntType(1) << 32*j; s = const_mod<IntType, m>::mult_add(mult, digit, s); } return s; } template<class IntType, IntType m, class Iter> IntType get_one_int(Iter& first, Iter last) { static const int log = ::boost::mpl::if_c<(m == 0), ::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>, ::boost::static_log2<m> >::type::value; static const int k = (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32; IntType s = 0; for(int j = 0; j < k; ++j) { if(first == last) { - throw ::std::invalid_argument("Not enough elements in call to seed."); + boost::throw_exception(::std::invalid_argument("Not enough elements in call to seed.")); } IntType digit = const_mod<IntType, m>::apply(IntType(*first++)); IntType mult = IntType(1) << 32*j; s = const_mod<IntType, m>::mult_add(mult, digit, s); } return s; } // TODO: work in-place whenever possible template<int w, std::size_t n, class SeedSeq, class UIntType> void seed_array_int_impl(SeedSeq& seq, UIntType (&x)[n]) { boost::uint_least32_t storage[((w+31)/32) * n]; seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n); for(std::size_t j = 0; j < n; j++) { UIntType val = 0; for(std::size_t k = 0; k < (w+31)/32; ++k) { val += static_cast<UIntType>(storage[(w+31)/32*j + k]) << 32*k; } x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits; } } template<int w, std::size_t n, class SeedSeq, class IntType> inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::true_) { typedef typename boost::make_unsigned<IntType>::type unsigned_array[n]; seed_array_int_impl<w>(seq, reinterpret_cast<unsigned_array&>(x)); } template<int w, std::size_t n, class SeedSeq, class IntType> inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::false_) { seed_array_int_impl<w>(seq, x); } template<int w, std::size_t n, class SeedSeq, class IntType> inline void seed_array_int(SeedSeq& seq, IntType (&x)[n]) { seed_array_int_impl<w>(seq, x, boost::is_signed<IntType>()); } template<int w, std::size_t n, class Iter, class UIntType> void fill_array_int_impl(Iter& first, Iter last, UIntType (&x)[n]) { for(std::size_t j = 0; j < n; j++) { UIntType val = 0; for(std::size_t k = 0; k < (w+31)/32; ++k) { if(first == last) { - throw std::invalid_argument("Not enough elements in call to seed."); + boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); } val += static_cast<UIntType>(*first++) << 32*k; } x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits; } } template<int w, std::size_t n, class Iter, class IntType> inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::true_) { typedef typename boost::make_unsigned<IntType>::type unsigned_array[n]; fill_array_int_impl<w>(first, last, reinterpret_cast<unsigned_array&>(x)); } template<int w, std::size_t n, class Iter, class IntType> inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::false_) { fill_array_int_impl<w>(first, last, x); } template<int w, std::size_t n, class Iter, class IntType> inline void fill_array_int(Iter& first, Iter last, IntType (&x)[n]) { fill_array_int_impl<w>(first, last, x, boost::is_signed<IntType>()); } template<int w, std::size_t n, class RealType> void seed_array_real_impl(const boost::uint_least32_t* storage, RealType (&x)[n]) { boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32)); RealType two32 = 4294967296.0; const RealType divisor = RealType(1)/detail::pow2<RealType>(w); unsigned int j; for(j = 0; j < n; ++j) { RealType val = RealType(0); RealType mult = divisor; for(int k = 0; k < w/32; ++k) { val += *storage++ * mult; mult *= two32; } if(mask != 0) { val += (*storage++ & mask) * mult; } BOOST_ASSERT(val >= 0); BOOST_ASSERT(val < 1); x[j] = val; } } template<int w, std::size_t n, class SeedSeq, class RealType> void seed_array_real(SeedSeq& seq, RealType (&x)[n]) { using std::pow; boost::uint_least32_t storage[((w+31)/32) * n]; seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n); seed_array_real_impl<w>(storage, x); } template<int w, std::size_t n, class Iter, class RealType> void fill_array_real(Iter& first, Iter last, RealType (&x)[n]) { boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32)); RealType two32 = 4294967296.0; const RealType divisor = RealType(1)/detail::pow2<RealType>(w); unsigned int j; for(j = 0; j < n; ++j) { RealType val = RealType(0); RealType mult = divisor; for(int k = 0; k < w/32; ++k, ++first) { - if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); val += *first * mult; mult *= two32; } if(mask != 0) { - if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); val += (*first & mask) * mult; ++first; } BOOST_ASSERT(val >= 0); BOOST_ASSERT(val < 1); x[j] = val; } } } } } #include <boost/random/detail/enable_warnings.hpp> #endif diff --git a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp index ef20915..393c455 100644 --- a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp +++ b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp @@ -1,46 +1,46 @@ /* boost random/detail/uniform_int_float.hpp header file * * Copyright Jens Maurer 2000-2001 * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int_float.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ * */ #ifndef BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP #define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP #include <boost/limits.hpp> #include <boost/config.hpp> #include <boost/integer.hpp> #include <boost/random/detail/config.hpp> #include <boost/random/detail/generator_bits.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { namespace detail { template<class URNG> class uniform_int_float { public: typedef URNG base_type; typedef typename base_type::result_type base_result; typedef typename boost::uint_t< (std::numeric_limits<boost::uintmax_t>::digits < std::numeric_limits<base_result>::digits)? std::numeric_limits<boost::uintmax_t>::digits : std::numeric_limits<base_result>::digits >::fast result_type; uniform_int_float(base_type& rng) : _rng(rng) {} diff --git a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp index be60389..3878fee 100644 --- a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp +++ b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp @@ -1,294 +1,285 @@ /* boost random/mersenne_twister.hpp header file * * Copyright Jens Maurer 2000-2001 * Copyright Steven Watanabe 2010 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: mersenne_twister.hpp 74867 2011-10-09 23:13:31Z steven_watanabe $ + * $Id$ * * Revision history + * 2013-10-14 fixed some warnings with Wshadow (mgaunard) * 2001-02-18 moved to individual header files */ #ifndef BOOST_RANDOM_MERSENNE_TWISTER_HPP #define BOOST_RANDOM_MERSENNE_TWISTER_HPP #include <iosfwd> #include <istream> #include <stdexcept> #include <boost/config.hpp> #include <boost/cstdint.hpp> #include <boost/integer/integer_mask.hpp> #include <boost/random/detail/config.hpp> #include <boost/random/detail/ptr_helper.hpp> #include <boost/random/detail/seed.hpp> #include <boost/random/detail/seed_impl.hpp> #include <boost/random/detail/generator_seed_seq.hpp> namespace boost { namespace random { /** * Instantiations of class template mersenne_twister_engine model a * \pseudo_random_number_generator. It uses the algorithm described in * * @blockquote * "Mersenne Twister: A 623-dimensionally equidistributed uniform * pseudo-random number generator", Makoto Matsumoto and Takuji Nishimura, * ACM Transactions on Modeling and Computer Simulation: Special Issue on - * Uniform Random Number Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Uniform Random Number Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote * * @xmlnote * The boost variant has been implemented from scratch and does not * derive from or use mt19937.c provided on the above WWW site. However, it * was verified that both produce identical output. * @endxmlnote * * The seeding from an integer was changed in April 2005 to address a * <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html">weakness</a>. - * + * * The quality of the generator crucially depends on the choice of the * parameters. User code should employ one of the sensibly parameterized * generators such as \mt19937 instead. * * The generator requires considerable amounts of memory for the storage of * its state array. For example, \mt11213b requires about 1408 bytes and * \mt19937 requires about 2496 bytes. */ template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f> class mersenne_twister_engine { public: typedef UIntType result_type; BOOST_STATIC_CONSTANT(std::size_t, word_size = w); BOOST_STATIC_CONSTANT(std::size_t, state_size = n); BOOST_STATIC_CONSTANT(std::size_t, shift_size = m); BOOST_STATIC_CONSTANT(std::size_t, mask_bits = r); BOOST_STATIC_CONSTANT(UIntType, xor_mask = a); BOOST_STATIC_CONSTANT(std::size_t, tempering_u = u); BOOST_STATIC_CONSTANT(UIntType, tempering_d = d); BOOST_STATIC_CONSTANT(std::size_t, tempering_s = s); BOOST_STATIC_CONSTANT(UIntType, tempering_b = b); BOOST_STATIC_CONSTANT(std::size_t, tempering_t = t); BOOST_STATIC_CONSTANT(UIntType, tempering_c = c); BOOST_STATIC_CONSTANT(std::size_t, tempering_l = l); BOOST_STATIC_CONSTANT(UIntType, initialization_multiplier = f); BOOST_STATIC_CONSTANT(UIntType, default_seed = 5489u); - + // backwards compatibility BOOST_STATIC_CONSTANT(UIntType, parameter_a = a); BOOST_STATIC_CONSTANT(std::size_t, output_u = u); BOOST_STATIC_CONSTANT(std::size_t, output_s = s); BOOST_STATIC_CONSTANT(UIntType, output_b = b); BOOST_STATIC_CONSTANT(std::size_t, output_t = t); BOOST_STATIC_CONSTANT(UIntType, output_c = c); BOOST_STATIC_CONSTANT(std::size_t, output_l = l); - + // old Boost.Random concept requirements BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); /** * Constructs a @c mersenne_twister_engine and calls @c seed(). */ mersenne_twister_engine() { seed(); } /** * Constructs a @c mersenne_twister_engine and calls @c seed(value). */ BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister_engine, UIntType, value) { seed(value); } template<class It> mersenne_twister_engine(It& first, It last) { seed(first,last); } /** * Constructs a mersenne_twister_engine and calls @c seed(gen). * * @xmlnote * The copy constructor will always be preferred over * the templated constructor. * @endxmlnote */ BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(mersenne_twister_engine, SeedSeq, seq) { seed(seq); } // compiler-generated copy ctor and assignment operator are fine /** Calls @c seed(default_seed). */ void seed() { seed(default_seed); } /** * Sets the state x(0) to v mod 2w. Then, iteratively, * sets x(i) to * (i + f * (x(i-1) xor (x(i-1) rshift w-2))) mod 2<sup>w</sup> * for i = 1 .. n-1. x(n) is the first value to be returned by operator(). */ BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister_engine, UIntType, value) { - // New seeding algorithm from + // New seeding algorithm from // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html // In the previous versions, MSBs of the seed affected only MSBs of the // state x[]. const UIntType mask = (max)(); x[0] = value & mask; for (i = 1; i < n; i++) { // See Knuth "The Art of Computer Programming" // Vol. 2, 3rd ed., page 106 x[i] = (f * (x[i-1] ^ (x[i-1] >> (w-2))) + i) & mask; } + + normalize_state(); } - + /** * Seeds a mersenne_twister_engine using values produced by seq.generate(). */ BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(mersenne_twister_engine, SeeqSeq, seq) { detail::seed_array_int<w>(seq, x); i = n; - // fix up the state if it's all zeroes. - if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { - for(std::size_t j = 1; j < n; ++j) { - if(x[j] != 0) return; - } - x[0] = static_cast<UIntType>(1) << (w-1); - } + normalize_state(); } /** Sets the state of the generator using values from an iterator range. */ template<class It> void seed(It& first, It last) { detail::fill_array_int<w>(first, last, x); i = n; - // fix up the state if it's all zeroes. - if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { - for(std::size_t j = 1; j < n; ++j) { - if(x[j] != 0) return; - } - x[0] = static_cast<UIntType>(1) << (w-1); - } + normalize_state(); } - + /** Returns the smallest value that the generator can produce. */ static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } /** Returns the largest value that the generator can produce. */ static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return boost::low_bits_mask_t<w>::sig_bits; } - + /** Produces the next value of the generator. */ result_type operator()(); /** Fills a range with random values */ template<class Iter> void generate(Iter first, Iter last) { detail::generate_from_int(*this, first, last); } /** * Advances the state of the generator by @c z steps. Equivalent to * * @code * for(unsigned long long i = 0; i < z; ++i) { * gen(); * } * @endcode */ void discard(boost::uintmax_t z) { for(boost::uintmax_t j = 0; j < z; ++j) { (*this)(); } } #ifndef BOOST_RANDOM_NO_STREAM_OPERATORS /** Writes a mersenne_twister_engine to a @c std::ostream */ template<class CharT, class Traits> friend std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& os, const mersenne_twister_engine& mt) { mt.print(os); return os; } - + /** Reads a mersenne_twister_engine from a @c std::istream */ template<class CharT, class Traits> friend std::basic_istream<CharT,Traits>& operator>>(std::basic_istream<CharT,Traits>& is, mersenne_twister_engine& mt) { for(std::size_t j = 0; j < mt.state_size; ++j) is >> mt.x[j] >> std::ws; // MSVC (up to 7.1) and Borland (up to 5.64) don't handle the template // value parameter "n" available from the class template scope, so use // the static constant with the same value mt.i = mt.state_size; return is; } #endif /** * Returns true if the two generators are in the same state, * and will thus produce identical sequences. */ - friend bool operator==(const mersenne_twister_engine& x, - const mersenne_twister_engine& y) + friend bool operator==(const mersenne_twister_engine& x_, + const mersenne_twister_engine& y_) { - if(x.i < y.i) return x.equal_imp(y); - else return y.equal_imp(x); + if(x_.i < y_.i) return x_.equal_imp(y_); + else return y_.equal_imp(x_); } - + /** * Returns true if the two generators are in different states. */ - friend bool operator!=(const mersenne_twister_engine& x, - const mersenne_twister_engine& y) - { return !(x == y); } + friend bool operator!=(const mersenne_twister_engine& x_, + const mersenne_twister_engine& y_) + { return !(x_ == y_); } private: /// \cond show_private void twist(); /** * Does the work of operator==. This is in a member function * for portability. Some compilers, such as msvc 7.1 and * Sun CC 5.10 can't access template parameters or static * members of the class from inline friend functions. * * requires i <= other.i */ bool equal_imp(const mersenne_twister_engine& other) const { UIntType back[n]; std::size_t offset = other.i - i; for(std::size_t j = 0; j + offset < n; ++j) if(x[j] != other.x[j+offset]) return false; rewind(&back[n-1], offset); for(std::size_t j = 0; j < offset; ++j) if(back[j + n - offset] != other.x[j]) return false; return true; } /** * Does the work of operator<<. This is in a member function * for portability. */ template<class CharT, class Traits> void print(std::basic_ostream<CharT, Traits>& os) const { @@ -301,92 +292,121 @@ private: } os << data[0]; for(std::size_t j = 1; j < n; ++j) { os << ' ' << data[j]; } } /** * Copies z elements of the state preceding x[0] into * the array whose last element is last. */ void rewind(UIntType* last, std::size_t z) const { const UIntType upper_mask = (~static_cast<UIntType>(0)) << r; const UIntType lower_mask = ~upper_mask; UIntType y0 = x[m-1] ^ x[n-1]; if(y0 & (static_cast<UIntType>(1) << (w-1))) { y0 = ((y0 ^ a) << 1) | 1; } else { y0 = y0 << 1; } for(std::size_t sz = 0; sz < z; ++sz) { UIntType y1 = rewind_find(last, sz, m-1) ^ rewind_find(last, sz, n-1); if(y1 & (static_cast<UIntType>(1) << (w-1))) { y1 = ((y1 ^ a) << 1) | 1; } else { y1 = y1 << 1; } *(last - sz) = (y0 & upper_mask) | (y1 & lower_mask); y0 = y1; } } /** + * Converts an arbitrary array into a valid generator state. + * First we normalize x[0], so that it contains the same + * value we would get by running the generator forwards + * and then in reverse. (The low order r bits are redundant). + * Then, if the state consists of all zeros, we set the + * high order bit of x[0] to 1. This function only needs to + * be called by seed, since the state transform preserves + * this relationship. + */ + void normalize_state() + { + const UIntType upper_mask = (~static_cast<UIntType>(0)) << r; + const UIntType lower_mask = ~upper_mask; + UIntType y0 = x[m-1] ^ x[n-1]; + if(y0 & (static_cast<UIntType>(1) << (w-1))) { + y0 = ((y0 ^ a) << 1) | 1; + } else { + y0 = y0 << 1; + } + x[0] = (x[0] & upper_mask) | (y0 & lower_mask); + + // fix up the state if it's all zeroes. + for(std::size_t j = 0; j < n; ++j) { + if(x[j] != 0) return; + } + x[0] = static_cast<UIntType>(1) << (w-1); + } + + /** * Given a pointer to the last element of the rewind array, * and the current size of the rewind array, finds an element * relative to the next available slot in the rewind array. */ UIntType rewind_find(UIntType* last, std::size_t size, std::size_t j) const { std::size_t index = (j + n - size + n - 1) % n; if(index < n - size) { return x[index]; } else { return *(last - (n - 1 - index)); } } /// \endcond // state representation: next output is o(x(i)) // x[0] ... x[k] x[k+1] ... x[n-1] represents // x(i-k) ... x(i) x(i+1) ... x(i-k+n-1) - UIntType x[n]; + UIntType x[n]; std::size_t i; }; /// \cond show_private #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION // A definition is required even for integral static constants #define BOOST_RANDOM_MT_DEFINE_CONSTANT(type, name) \ template<class UIntType, std::size_t w, std::size_t n, std::size_t m, \ std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, \ UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f> \ const type mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::name BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, word_size); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, state_size); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, shift_size); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, mask_bits); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, xor_mask); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_u); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_d); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_s); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_b); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_t); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_c); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_l); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, initialization_multiplier); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, default_seed); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, parameter_a); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_u ); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_s); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, output_b); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_t); BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, output_c); BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_l); BOOST_RANDOM_MT_DEFINE_CONSTANT(bool, has_fixed_range); #undef BOOST_RANDOM_MT_DEFINE_CONSTANT @@ -436,85 +456,85 @@ mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::twist() UIntType y = (x[n-1] & upper_mask) | (x[0] & lower_mask); x[n-1] = x[m-1] ^ (y >> 1) ^ ((x[0]&1) * a); i = 0; } /// \endcond template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f> inline typename mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::result_type mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::operator()() { if(i == n) twist(); // Step 4 UIntType z = x[i]; ++i; z ^= ((z >> u) & d); z ^= ((z << s) & b); z ^= ((z << t) & c); z ^= (z >> l); return z; } /** * The specializations \mt11213b and \mt19937 are from * * @blockquote * "Mersenne Twister: A 623-dimensionally equidistributed * uniform pseudo-random number generator", Makoto Matsumoto * and Takuji Nishimura, ACM Transactions on Modeling and * Computer Simulation: Special Issue on Uniform Random Number - * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ typedef mersenne_twister_engine<uint32_t,32,351,175,19,0xccab8ee7, 11,0xffffffff,7,0x31b6ab00,15,0xffe50000,17,1812433253> mt11213b; /** * The specializations \mt11213b and \mt19937 are from * * @blockquote * "Mersenne Twister: A 623-dimensionally equidistributed * uniform pseudo-random number generator", Makoto Matsumoto * and Takuji Nishimura, ACM Transactions on Modeling and * Computer Simulation: Special Issue on Uniform Random Number - * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ typedef mersenne_twister_engine<uint32_t,32,624,397,31,0x9908b0df, 11,0xffffffff,7,0x9d2c5680,15,0xefc60000,18,1812433253> mt19937; #if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T) typedef mersenne_twister_engine<uint64_t,64,312,156,31, UINT64_C(0xb5026f5aa96619e9),29,UINT64_C(0x5555555555555555),17, UINT64_C(0x71d67fffeda60000),37,UINT64_C(0xfff7eee000000000),43, UINT64_C(6364136223846793005)> mt19937_64; #endif /// \cond show_deprecated template<class UIntType, int w, int n, int m, int r, UIntType a, int u, std::size_t s, UIntType b, int t, UIntType c, int l, UIntType v> class mersenne_twister : public mersenne_twister_engine<UIntType, w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253> { typedef mersenne_twister_engine<UIntType, w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253> base_type; public: mersenne_twister() {} BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(mersenne_twister, Gen, gen) { seed(gen); } BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister, UIntType, val) { seed(val); } template<class It> mersenne_twister(It& first, It last) : base_type(first, last) {} void seed() { base_type::seed(); } BOOST_RANDOM_DETAIL_GENERATOR_SEED(mersenne_twister, Gen, gen) diff --git a/3rdParty/Boost/src/boost/random/uniform_int.hpp b/3rdParty/Boost/src/boost/random/uniform_int.hpp index 7ae3b92..4362652 100644 --- a/3rdParty/Boost/src/boost/random/uniform_int.hpp +++ b/3rdParty/Boost/src/boost/random/uniform_int.hpp @@ -1,45 +1,45 @@ /* boost random/uniform_int.hpp header file * * Copyright Jens Maurer 2000-2001 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-04-08 added min<max assertion (N. Becker) * 2001-02-18 moved to individual header files */ #ifndef BOOST_RANDOM_UNIFORM_INT_HPP #define BOOST_RANDOM_UNIFORM_INT_HPP #include <boost/assert.hpp> #include <boost/random/uniform_int_distribution.hpp> namespace boost { /** * The distribution function uniform_int models a \random_distribution. * On each invocation, it returns a random integer value uniformly * distributed in the set of integer numbers {min, min+1, min+2, ..., max}. * * The template parameter IntType shall denote an integer-like value type. * * This class is deprecated. Please use @c uniform_int_distribution in * new code. */ template<class IntType = int> class uniform_int : public random::uniform_int_distribution<IntType> { typedef random::uniform_int_distribution<IntType> base_type; public: class param_type : public base_type::param_type { public: typedef uniform_int distribution_type; /** diff --git a/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp index 0612028..a175025 100644 --- a/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp +++ b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp @@ -1,46 +1,46 @@ /* boost random/uniform_int_distribution.hpp header file * * Copyright Jens Maurer 2000-2001 * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int_distribution.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-04-08 added min<max assertion (N. Becker) * 2001-02-18 moved to individual header files */ #ifndef BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP #define BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP #include <iosfwd> #include <ios> #include <istream> #include <boost/config.hpp> #include <boost/limits.hpp> #include <boost/assert.hpp> #include <boost/random/detail/config.hpp> #include <boost/random/detail/operators.hpp> #include <boost/random/detail/uniform_int_float.hpp> #include <boost/random/detail/signed_unsigned_tools.hpp> #include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/is_integral.hpp> namespace boost { namespace random { namespace detail { #ifdef BOOST_MSVC #pragma warning(push) // disable division by zero warning, since we can't // actually divide by zero. #pragma warning(disable:4723) #endif template<class Engine, class T> diff --git a/3rdParty/Boost/src/boost/random/variate_generator.hpp b/3rdParty/Boost/src/boost/random/variate_generator.hpp index ac69800..6d5aac4 100644 --- a/3rdParty/Boost/src/boost/random/variate_generator.hpp +++ b/3rdParty/Boost/src/boost/random/variate_generator.hpp @@ -1,46 +1,46 @@ /* boost random/variate_generator.hpp header file * * Copyright Jens Maurer 2002 * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * - * $Id: variate_generator.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * */ #ifndef BOOST_RANDOM_RANDOM_GENERATOR_HPP #define BOOST_RANDOM_RANDOM_GENERATOR_HPP #include <boost/random/detail/ptr_helper.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { /// \cond hide_private_members namespace random { ///\endcond /** * A random variate generator is used to join a random number * generator together with a random number distribution. * Boost.Random provides a vast choice of \generators as well * as \distributions. * * The argument for the template parameter Engine shall be of * the form U, U&, or U*, where U models a * \uniform_random_number_generator. Then, the member * engine_value_type names U (not the pointer or reference to U). * * Specializations of @c variate_generator satisfy the * requirements of CopyConstructible. They also satisfy the * requirements of Assignable unless the template parameter * Engine is of the form U&. * * The complexity of all functions specified in this section |