You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/27 08:08:39 UTC

svn commit: r1140024 [8/15] - in /incubator/mesos/trunk: ./ ec2/ ec2/deploy.karmic64/ ec2/deploy.solaris/ frameworks/torque/nexus-hpl/ include/mesos/ src/ src/common/ src/configurator/ src/detector/ src/examples/ src/examples/java/ src/examples/python/...

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/ptr_helper.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/ptr_helper.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/ptr_helper.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/ptr_helper.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,94 @@
+/* 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 $
+ *
+ */
+
+#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

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/seed.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/seed.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/seed.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/seed.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,89 @@
+/* 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 60755 2010-03-22 00:45:06Z steven_watanabe $
+ */
+
+#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)
+
+#define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \
+    explicit Self(const T& x)
+
+#define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
+    void seed(const T& x)
+
+}
+}
+}
+
+#else
+
+#include <boost/type_traits/is_arithmetic.hpp>
+#include <boost/mpl/bool.hpp>
+
+#define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
+    Self(Self& other) { *this = other; }                                \
+    Self(const Self& other) { *this = other; }                          \
+    template<class Generator>                                           \
+    explicit Self(Generator& gen) {                                     \
+        boost_random_constructor_impl(gen, ::boost::is_arithmetic<Generator>());\
+    }                                                                   \
+    template<class Generator>                                           \
+    void boost_random_constructor_impl(Generator& gen, ::boost::mpl::false_)
+
+#define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen)    \
+    template<class Generator>                                       \
+    void seed(Generator& gen) {                                     \
+        boost_random_seed_impl(gen, ::boost::is_arithmetic<Generator>());\
+    }\
+    template<class Generator>\
+    void boost_random_seed_impl(Generator& gen, ::boost::mpl::false_)
+
+#define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \
+    explicit Self(const T& x) { boost_random_constructor_impl(x, ::boost::mpl::true_()); }\
+    void boost_random_constructor_impl(const T& x, ::boost::mpl::true_)
+
+#define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
+    void seed(const T& x) { boost_random_seed_impl(x, ::boost::mpl::true_()); }\
+    void boost_random_seed_impl(const T& x, ::boost::mpl::true_)
+
+#endif
+
+#endif

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/signed_unsigned_tools.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/signed_unsigned_tools.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/signed_unsigned_tools.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/signed_unsigned_tools.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,89 @@
+/* boost random/detail/signed_unsigned_tools.hpp header file
+ *
+ * Copyright Jens Maurer 2006
+ * 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.
+ */
+
+#ifndef BOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+#define BOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+
+#include <boost/limits.hpp>
+#include <boost/config.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
+
+namespace boost {
+namespace random {
+namespace detail {
+
+
+/*
+ * Compute x - y, we know that x >= y, return an unsigned value.
+ */
+
+template<class T, bool sgn = std::numeric_limits<T>::is_signed>
+struct subtract { };
+
+template<class T>
+struct subtract<T, /* signed */ false>
+{
+  typedef T result_type;
+  result_type operator()(T x, T y) { return x - y; }
+};
+
+template<class T>
+struct subtract<T, /* signed */ true>
+{
+  typedef typename make_unsigned<T>::type result_type;
+  result_type operator()(T x, T y)
+  {
+    if (y >= 0)   // because x >= y, it follows that x >= 0, too
+      return result_type(x) - result_type(y);
+    if (x >= 0)   // y < 0
+      // avoid the nasty two's complement case for y == min()
+      return result_type(x) + result_type(-(y+1)) + 1;
+    // both x and y are negative: no signed overflow
+    return result_type(x - y);
+  }
+};
+
+/*
+ * Compute x + y, x is unsigned, result fits in type of "y".
+ */
+
+template<class T1, class T2, bool sgn = std::numeric_limits<T2>::is_signed>
+struct add { };
+
+template<class T1, class T2>
+struct add<T1, T2, /* signed */ false>
+{
+  typedef T2 result_type;
+  result_type operator()(T1 x, T2 y) { return T2(x) + y; }
+};
+
+template<class T1, class T2>
+struct add<T1, T2, /* signed */ true>
+{
+  typedef T2 result_type;
+  result_type operator()(T1 x, T2 y)
+  {
+    if (y >= 0)
+      return T2(x) + y;
+    // y < 0
+    if (x >= T1(-(y+1)))  // result >= 0 after subtraction
+      // avoid the nasty two's complement edge case for y == min()
+      return T2(x - T1(-(y+1)) - 1);
+    // abs(x) < abs(y), thus T2 able to represent x
+    return T2(x) + y;
+  }
+};
+
+} // namespace detail
+} // namespace random
+} // namespace boost
+
+#endif // BOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/uniform_int_float.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/uniform_int_float.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/uniform_int_float.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/uniform_int_float.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,85 @@
+/* boost random/detail/uniform_int_float.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_float.hpp 52492 2009-04-19 14:55:57Z steven_watanabe $
+ *
+ */
+
+#ifndef BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
+#define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
+
+#include <boost/config.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/uniform_01.hpp>
+
+
+namespace boost {
+namespace random {
+namespace detail {
+
+template<class UniformRandomNumberGenerator, class IntType = unsigned long>
+class uniform_int_float
+{
+public:
+  typedef UniformRandomNumberGenerator base_type;
+  typedef IntType result_type;
+
+  uniform_int_float(base_type rng, IntType min_arg = 0, IntType max_arg = 0xffffffff)
+    : _rng(rng), _min(min_arg), _max(max_arg)
+  {
+    init();
+  }
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
+  base_type& base() { return _rng.base(); }
+  const base_type& base() const { return _rng.base(); }
+
+  result_type operator()()
+  {
+    return static_cast<IntType>(_rng() * _range) + _min;
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud)
+  {
+    os << ud._min << " " << ud._max;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, uniform_int_float& ud)
+  {
+    is >> std::ws >> ud._min >> std::ws >> ud._max;
+    ud.init();
+    return is;
+  }
+#endif
+
+private:
+  void init()
+  {
+    _range = static_cast<base_result>(_max-_min)+1;
+  }
+
+  typedef typename base_type::result_type base_result;
+  uniform_01<base_type> _rng;
+  result_type _min, _max;
+  base_result _range;
+};
+
+
+} // namespace detail
+} // namespace random
+} // namespace boost
+
+#endif // BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/discard_block.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/discard_block.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/discard_block.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/discard_block.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,132 @@
+/* boost random/discard_block.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: discard_block.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-03-02  created
+ */
+
+#ifndef BOOST_RANDOM_DISCARD_BLOCK_HPP
+#define BOOST_RANDOM_DISCARD_BLOCK_HPP
+
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+
+
+namespace boost {
+namespace random {
+
+/**
+ * The class template \discard_block is a model of
+ * \pseudo_random_number_generator.  It modifies
+ * another generator by discarding parts of its output.
+ * Out of every block of @c r results, the first @c p
+ * will be returned and the rest discarded.
+ *
+ * Requires: 0 < p <= r
+ */
+template<class UniformRandomNumberGenerator, unsigned int p, unsigned int r>
+class discard_block
+{
+public:
+  typedef UniformRandomNumberGenerator base_type;
+  typedef typename base_type::result_type result_type;
+
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  BOOST_STATIC_CONSTANT(unsigned int, total_block = p);
+  BOOST_STATIC_CONSTANT(unsigned int, returned_block = r);
+
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+  BOOST_STATIC_ASSERT(total_block >= returned_block);
+#endif
+
+  discard_block() : _rng(), _n(0) { }
+  explicit discard_block(const base_type & rng) : _rng(rng), _n(0) { }
+  template<class T> explicit discard_block(T s) : _rng(s), _n(0) {}
+  template<class It> discard_block(It& first, It last)
+    : _rng(first, last), _n(0) { }
+  void seed() { _rng.seed(); _n = 0; }
+  template<class T> void seed(T s) { _rng.seed(s); _n = 0; }
+  template<class It> void seed(It& first, It last)
+  { _n = 0; _rng.seed(first, last); }
+
+  const base_type& base() const { return _rng; }
+
+  result_type operator()()
+  {
+    if(_n >= returned_block) {
+      // discard values of random number generator
+      for( ; _n < total_block; ++_n)
+        _rng();
+      _n = 0;
+    }
+    ++_n;
+    return _rng();
+  }
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.min)(); }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.max)(); }
+  static bool validation(result_type x) { return true; }  // dummy
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const discard_block& s)
+  {
+    os << s._rng << " " << s._n << " ";
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, discard_block& s)
+  {
+    is >> s._rng >> std::ws >> s._n >> std::ws;
+    return is;
+  }
+#endif
+
+  friend bool operator==(const discard_block& x, const discard_block& y)
+  { return x._rng == y._rng && x._n == y._n; }
+  friend bool operator!=(const discard_block& x, const discard_block& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const discard_block& rhs) const
+  { return _rng == rhs._rng && _n == rhs._n; }
+  bool operator!=(const discard_block& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  base_type _rng;
+  unsigned int _n;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UniformRandomNumberGenerator, unsigned int p, unsigned int r>
+const bool discard_block<UniformRandomNumberGenerator, p, r>::has_fixed_range;
+template<class UniformRandomNumberGenerator, unsigned int p, unsigned int r>
+const unsigned int discard_block<UniformRandomNumberGenerator, p, r>::total_block;
+template<class UniformRandomNumberGenerator, unsigned int p, unsigned int r>
+const unsigned int discard_block<UniformRandomNumberGenerator, p, r>::returned_block;
+#endif
+
+} // namespace random
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_DISCARD_BLOCK_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/exponential_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/exponential_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/exponential_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/exponential_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,86 @@
+/* boost random/exponential_distribution.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: exponential_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_EXPONENTIAL_DISTRIBUTION_HPP
+#define BOOST_RANDOM_EXPONENTIAL_DISTRIBUTION_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <cassert>
+#include <iostream>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+
+namespace boost {
+
+/**
+ * The exponential distribution has a single parameter lambda.
+ *
+ * It has \f$p(x) = \lambda e^{-\lambda x}\f$
+ */
+template<class RealType = double>
+class exponential_distribution
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+
+#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) && !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300)
+  BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
+#endif
+
+  explicit exponential_distribution(result_type lambda_arg = result_type(1))
+    : _lambda(lambda_arg) { assert(_lambda > result_type(0)); }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  result_type lambda() const { return _lambda; }
+
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  { 
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::log;
+#endif
+    return -result_type(1) / _lambda * log(result_type(1)-eng());
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const exponential_distribution& ed)
+  {
+    os << ed._lambda;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, exponential_distribution& ed)
+  {
+    is >> std::ws >> ed._lambda;
+    return is;
+  }
+#endif
+
+private:
+  result_type _lambda;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_EXPONENTIAL_DISTRIBUTION_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/gamma_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/gamma_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/gamma_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/gamma_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,143 @@
+/* boost random/gamma_distribution.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: gamma_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ */
+
+#ifndef BOOST_RANDOM_GAMMA_DISTRIBUTION_HPP
+#define BOOST_RANDOM_GAMMA_DISTRIBUTION_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <cassert>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/exponential_distribution.hpp>
+
+namespace boost {
+
+// The algorithm is taken from Knuth
+
+/**
+ * The gamma distribution is a continuous distribution with a single
+ * parameter alpha.
+ *
+ * It has \f$p(x) = x^{\alpha-1}\frac{e^{-x}}{\Gamma(\alpha)}\f$.
+ */
+template<class RealType = double>
+class gamma_distribution
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+  BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
+#endif
+
+  explicit gamma_distribution(const result_type& alpha_arg = result_type(1))
+    : _exp(result_type(1)), _alpha(alpha_arg)
+  {
+    assert(_alpha > result_type(0));
+    init();
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  RealType alpha() const { return _alpha; }
+
+  void reset() { _exp.reset(); }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::tan; using std::sqrt; using std::exp; using std::log;
+    using std::pow;
+#endif
+    if(_alpha == result_type(1)) {
+      return _exp(eng);
+    } else if(_alpha > result_type(1)) {
+      // Can we have a boost::mathconst please?
+      const result_type pi = result_type(3.14159265358979323846);
+      for(;;) {
+        result_type y = tan(pi * eng());
+        result_type x = sqrt(result_type(2)*_alpha-result_type(1))*y
+          + _alpha-result_type(1);
+        if(x <= result_type(0))
+          continue;
+        if(eng() >
+           (result_type(1)+y*y) * exp((_alpha-result_type(1))
+                                        *log(x/(_alpha-result_type(1)))
+                                        - sqrt(result_type(2)*_alpha
+                                               -result_type(1))*y))
+          continue;
+        return x;
+      }
+    } else /* alpha < 1.0 */ {
+      for(;;) {
+        result_type u = eng();
+        result_type y = _exp(eng);
+        result_type x, q;
+        if(u < _p) {
+          x = exp(-y/_alpha);
+          q = _p*exp(-x);
+        } else {
+          x = result_type(1)+y;
+          q = _p + (result_type(1)-_p) * pow(x, _alpha-result_type(1));
+        }
+        if(u >= q)
+          continue;
+        return x;
+      }
+    }
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const gamma_distribution& gd)
+  {
+    os << gd._alpha;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, gamma_distribution& gd)
+  {
+    is >> std::ws >> gd._alpha;
+    gd.init();
+    return is;
+  }
+#endif
+
+private:
+  /// \cond hide_private_members
+  void init()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::exp;
+#endif
+    _p = exp(result_type(1)) / (_alpha + exp(result_type(1)));
+  }
+  /// \endcond
+
+  exponential_distribution<RealType> _exp;
+  result_type _alpha;
+  // some data precomputed from the parameters
+  result_type _p;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_GAMMA_DISTRIBUTION_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/geometric_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/geometric_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/geometric_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/geometric_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,118 @@
+/* boost random/geometric_distribution.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: geometric_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
+#define BOOST_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>          // std::log
+#include <cassert>
+#include <iostream>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/uniform_01.hpp>
+
+namespace boost {
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+// Special gcc workaround: gcc 2.95.x ignores using-declarations
+// in template classes (confirmed by gcc author Martin v. Loewis)
+  using std::log;
+#endif
+
+/**
+ * An instantiation of the class template @c geometric_distribution models
+ * a \random_distribution.  The distribution produces positive
+ * integers which are the number of bernoulli trials
+ * with probability @c p required to get one that fails.
+ *
+ * For the geometric distribution, \f$p(i) = (1-p) p^{i-1}\f$.
+ */
+template<class IntType = int, class RealType = double>
+class geometric_distribution
+{
+public:
+  typedef RealType input_type;
+  typedef IntType result_type;
+
+  /**
+   * Contructs a new geometric_distribution with the paramter @c p.
+   *
+   * Requires: 0 < p < 1
+   */
+  explicit geometric_distribution(const RealType& p = RealType(0.5))
+    : _p(p)
+  {
+    assert(RealType(0) < _p && _p < RealType(1));
+    init();
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /**
+   * Returns: the distribution parameter @c p
+   */
+  RealType p() const { return _p; }
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::log;
+    using std::floor;
+#endif
+    return IntType(floor(log(RealType(1)-eng()) / _log_p)) + IntType(1);
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const geometric_distribution& gd)
+  {
+    os << gd._p;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, geometric_distribution& gd)
+  {
+    is >> std::ws >> gd._p;
+    gd.init();
+    return is;
+  }
+#endif
+
+private:
+
+  /// \cond hide_private_functions
+
+  void init()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::log;
+#endif
+    _log_p = log(_p);
+  }
+
+  /// \endcond
+
+  RealType _p;
+  RealType _log_p;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
+

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/inversive_congruential.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/inversive_congruential.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/inversive_congruential.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/inversive_congruential.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,173 @@
+/* boost random/inversive_congruential.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: inversive_congruential.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_INVERSIVE_CONGRUENTIAL_HPP
+#define BOOST_RANDOM_INVERSIVE_CONGRUENTIAL_HPP
+
+#include <iostream>
+#include <cassert>
+#include <stdexcept>
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/const_mod.hpp>
+
+namespace boost {
+namespace random {
+
+// Eichenauer and Lehn 1986
+/**
+ * Instantiations of class template @c inversive_congruential model a
+ * \pseudo_random_number_generator. It uses the inversive congruential
+ * algorithm (ICG) described in
+ *
+ *  @blockquote
+ *  "Inversive pseudorandom number generators: concepts, results and links",
+ *  Peter Hellekalek, In: "Proceedings of the 1995 Winter Simulation
+ *  Conference", C. Alexopoulos, K. Kang, W.R. Lilegdon, and D. Goldsman
+ *  (editors), 1995, pp. 255-262. ftp://random.mat.sbg.ac.at/pub/data/wsc95.ps
+ *  @endblockquote
+ *
+ * The output sequence is defined by x(n+1) = (a*inv(x(n)) - b) (mod p),
+ * where x(0), a, b, and the prime number p are parameters of the generator.
+ * The expression inv(k) denotes the multiplicative inverse of k in the
+ * field of integer numbers modulo p, with inv(0) := 0.
+ *
+ * The template parameter IntType shall denote a signed integral type large
+ * enough to hold p; a, b, and p are the parameters of the generators. The
+ * template parameter val is the validation value checked by validation.
+ *
+ * @xmlnote
+ * The implementation currently uses the Euclidian Algorithm to compute
+ * the multiplicative inverse. Therefore, the inversive generators are about
+ * 10-20 times slower than the others (see section"performance"). However,
+ * the paper talks of only 3x slowdown, so the Euclidian Algorithm is probably
+ * not optimal for calculating the multiplicative inverse.
+ * @endxmlnote
+ */
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+class inversive_congruential
+{
+public:
+  typedef IntType result_type;
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+  static const bool has_fixed_range = true;
+  static const result_type min_value = (b == 0 ? 1 : 0);
+  static const result_type max_value = p-1;
+#else
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+#endif
+  BOOST_STATIC_CONSTANT(result_type, multiplier = a);
+  BOOST_STATIC_CONSTANT(result_type, increment = b);
+  BOOST_STATIC_CONSTANT(result_type, modulus = p);
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return b == 0 ? 1 : 0; }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return p-1; }
+
+  /**
+   * Constructs an inversive_congruential generator with
+   * @c y0 as the initial state.
+   */
+  explicit inversive_congruential(IntType y0 = 1) : value(y0)
+  {
+    BOOST_STATIC_ASSERT(b >= 0);
+    BOOST_STATIC_ASSERT(p > 1);
+    BOOST_STATIC_ASSERT(a >= 1);
+    if(b == 0) 
+      assert(y0 > 0); 
+  }
+  template<class It> inversive_congruential(It& first, It last)
+  { seed(first, last); }
+
+  /** Changes the current state to y0. */
+  void seed(IntType y0 = 1) { value = y0; if(b == 0) assert(y0 > 0); }
+  template<class It> void seed(It& first, It last)
+  {
+    if(first == last)
+      throw std::invalid_argument("inversive_congruential::seed");
+    value = *first++;
+  }
+  IntType operator()()
+  {
+    typedef const_mod<IntType, p> do_mod;
+    value = do_mod::mult_add(a, do_mod::invert(value), b);
+    return value;
+  }
+
+  static bool validation(result_type x) { return val == x; }
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, inversive_congruential x)
+  { os << x.value; return os; }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, inversive_congruential& x)
+  { is >> x.value; return is; }
+#endif
+
+  friend bool operator==(inversive_congruential x, inversive_congruential y)
+  { return x.value == y.value; }
+  friend bool operator!=(inversive_congruential x, inversive_congruential y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(inversive_congruential rhs) const
+  { return value == rhs.value; }
+  bool operator!=(inversive_congruential rhs) const
+  { return !(*this == rhs); }
+#endif
+private:
+  IntType value;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const bool inversive_congruential<IntType, a, b, p, val>::has_fixed_range;
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const typename inversive_congruential<IntType, a, b, p, val>::result_type inversive_congruential<IntType, a, b, p, val>::min_value;
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const typename inversive_congruential<IntType, a, b, p, val>::result_type inversive_congruential<IntType, a, b, p, val>::max_value;
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const typename inversive_congruential<IntType, a, b, p, val>::result_type inversive_congruential<IntType, a, b, p, val>::multiplier;
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const typename inversive_congruential<IntType, a, b, p, val>::result_type inversive_congruential<IntType, a, b, p, val>::increment;
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
+const typename inversive_congruential<IntType, a, b, p, val>::result_type inversive_congruential<IntType, a, b, p, val>::modulus;
+#endif
+
+} // namespace random
+
+/**
+ * The specialization hellekalek1995 was suggested in
+ *
+ *  @blockquote
+ *  "Inversive pseudorandom number generators: concepts, results and links",
+ *  Peter Hellekalek, In: "Proceedings of the 1995 Winter Simulation
+ *  Conference", C. Alexopoulos, K. Kang, W.R. Lilegdon, and D. Goldsman
+ *  (editors), 1995, pp. 255-262. ftp://random.mat.sbg.ac.at/pub/data/wsc95.ps
+ *  @endblockquote
+ */
+typedef random::inversive_congruential<int32_t, 9102, 2147483647-36884165,
+  2147483647, 0> hellekalek1995;
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_INVERSIVE_CONGRUENTIAL_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lagged_fibonacci.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lagged_fibonacci.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lagged_fibonacci.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lagged_fibonacci.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,605 @@
+/* boost random/lagged_fibonacci.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: lagged_fibonacci.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_LAGGED_FIBONACCI_HPP
+#define BOOST_RANDOM_LAGGED_FIBONACCI_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <iostream>
+#include <algorithm>     // std::max
+#include <iterator>
+#include <boost/config/no_tr1/cmath.hpp>         // std::pow
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_01.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/seed.hpp>
+#include <boost/random/detail/pass_through_engine.hpp>
+
+namespace boost {
+namespace random {
+
+#if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
+#  define BOOST_RANDOM_EXTRACT_LF
+#endif
+
+#if defined(__APPLE_CC__) && defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 3)
+#  define BOOST_RANDOM_EXTRACT_LF
+#endif
+
+#  ifdef BOOST_RANDOM_EXTRACT_LF
+namespace detail
+{
+  template<class IStream, class F, class RealType>
+  IStream&
+  extract_lagged_fibonacci_01(
+      IStream& is
+      , F const& f
+      , unsigned int& i
+      , RealType* x
+      , RealType modulus)
+  {
+        is >> i >> std::ws;
+        for(unsigned int i = 0; i < f.long_lag; ++i)
+        {
+            RealType value;
+            is >> value >> std::ws;
+            x[i] = value / modulus;
+        }
+        return is;
+  }
+
+  template<class IStream, class F, class UIntType>
+  IStream&
+  extract_lagged_fibonacci(
+      IStream& is
+      , F const& f
+      , unsigned int& i
+      , UIntType* x)
+  {
+      is >> i >> std::ws;
+      for(unsigned int i = 0; i < f.long_lag; ++i)
+          is >> x[i] >> std::ws;
+      return is;
+  }
+}
+#  endif
+
+/** 
+ * Instantiations of class template \lagged_fibonacci model a
+ * \pseudo_random_number_generator. It uses a lagged Fibonacci
+ * algorithm with two lags @c p and @c q:
+ * x(i) = x(i-p) + x(i-q) (mod 2<sup>w</sup>) with p > q.
+ */
+template<class UIntType, int w, unsigned int p, unsigned int q,
+         UIntType val = 0>
+class lagged_fibonacci
+{
+public:
+  typedef UIntType result_type;
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  BOOST_STATIC_CONSTANT(int, word_size = w);
+  BOOST_STATIC_CONSTANT(unsigned int, long_lag = p);
+  BOOST_STATIC_CONSTANT(unsigned int, short_lag = q);
+
+  /**
+   * Returns: the smallest value that the generator can produce
+   */
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
+  /**
+   * Returns: the largest value that the generator can produce
+   */
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return wordmask; }
+
+  /**
+   * Creates a new @c lagged_fibonacci generator and calls @c seed()
+   */
+  lagged_fibonacci() { init_wordmask(); seed(); }
+  /**
+   * Creates a new @c lagged_fibonacci generator and calls @c seed(value)
+   */
+  explicit lagged_fibonacci(uint32_t value) { init_wordmask(); seed(value); }
+  /**
+   * Creates a new @c lagged_fibonacci generator and calls @c seed(first, last)
+   */
+  template<class It> lagged_fibonacci(It& first, It last)
+  { init_wordmask(); seed(first, last); }
+  // compiler-generated copy ctor and assignment operator are fine
+
+private:
+  /// \cond hide_private_members
+  void init_wordmask()
+  {
+    wordmask = 0;
+    for(int j = 0; j < w; ++j)
+      wordmask |= (1u << j);
+  }
+  /// \endcond
+
+public:
+  /**
+   * Sets the state of the generator to values produced by
+   * a \minstd_rand generator.
+   */
+  void seed(uint32_t value = 331u)
+  {
+    minstd_rand0 gen(value);
+    for(unsigned int j = 0; j < long_lag; ++j)
+      x[j] = gen() & wordmask;
+    i = long_lag;
+  }
+
+  /**
+   * Sets the state of the generator to values from the iterator
+   * range [first, last).  If there are not enough elements in the
+   * range [first, last) throws @c std::invalid_argument.
+   */
+  template<class It>
+  void seed(It& first, It last)
+  {
+    // word size could be smaller than the seed values
+    unsigned int j;
+    for(j = 0; j < long_lag && first != last; ++j, ++first)
+      x[j] = *first & wordmask;
+    i = long_lag;
+    if(first == last && j < long_lag)
+      throw std::invalid_argument("lagged_fibonacci::seed");
+  }
+
+  /**
+   * Returns: the next value of the generator
+   */
+  result_type operator()()
+  {
+    if(i >= long_lag)
+      fill();
+    return x[i++];
+  }
+
+  static bool validation(result_type x)
+  {
+    return x == val;
+  }
+  
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci& f)
+  {
+    os << f.i << " ";
+    for(unsigned int i = 0; i < f.long_lag; ++i)
+      os << f.x[i] << " ";
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT, Traits>&
+  operator>>(std::basic_istream<CharT, Traits>& is, lagged_fibonacci& f)
+  {
+# ifdef BOOST_RANDOM_EXTRACT_LF
+      return detail::extract_lagged_fibonacci(is, f, f.i, f.x);
+# else
+      is >> f.i >> std::ws;
+      for(unsigned int i = 0; i < f.long_lag; ++i)
+          is >> f.x[i] >> std::ws;
+      return is;
+# endif 
+  }
+#endif
+
+  friend bool operator==(const lagged_fibonacci& x, const lagged_fibonacci& y)
+  { return x.i == y.i && std::equal(x.x, x.x+long_lag, y.x); }
+  friend bool operator!=(const lagged_fibonacci& x,
+                         const lagged_fibonacci& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const lagged_fibonacci& rhs) const
+  { return i == rhs.i && std::equal(x, x+long_lag, rhs.x); }
+  bool operator!=(const lagged_fibonacci& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  /// \cond hide_private_members
+  void fill();
+  /// \endcond
+
+  UIntType wordmask;
+  unsigned int i;
+  UIntType x[long_lag];
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UIntType, int w, unsigned int p, unsigned int q, UIntType val>
+const bool lagged_fibonacci<UIntType, w, p, q, val>::has_fixed_range;
+template<class UIntType, int w, unsigned int p, unsigned int q, UIntType val>
+const unsigned int lagged_fibonacci<UIntType, w, p, q, val>::long_lag;
+template<class UIntType, int w, unsigned int p, unsigned int q, UIntType val>
+const unsigned int lagged_fibonacci<UIntType, w, p, q, val>::short_lag;
+#endif
+
+/// \cond hide_private_members
+
+template<class UIntType, int w, unsigned int p, unsigned int q, UIntType val>
+void lagged_fibonacci<UIntType, w, p, q, val>::fill()
+{
+  // two loops to avoid costly modulo operations
+  {  // extra scope for MSVC brokenness w.r.t. for scope
+  for(unsigned int j = 0; j < short_lag; ++j)
+    x[j] = (x[j] + x[j+(long_lag-short_lag)]) & wordmask;
+  }
+  for(unsigned int j = short_lag; j < long_lag; ++j)
+    x[j] = (x[j] + x[j-short_lag]) & wordmask;
+  i = 0;
+}
+
+
+
+// lagged Fibonacci generator for the range [0..1)
+// contributed by Matthias Troyer
+// for p=55, q=24 originally by G. J. Mitchell and D. P. Moore 1958
+
+template<class T, unsigned int p, unsigned int q>
+struct fibonacci_validation
+{
+  BOOST_STATIC_CONSTANT(bool, is_specialized = false);
+  static T value() { return 0; }
+  static T tolerance() { return 0; }
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class T, unsigned int p, unsigned int q>
+const bool fibonacci_validation<T, p, q>::is_specialized;
+#endif
+
+#define BOOST_RANDOM_FIBONACCI_VAL(T,P,Q,V,E) \
+template<> \
+struct fibonacci_validation<T, P, Q>  \
+{                                     \
+  BOOST_STATIC_CONSTANT(bool, is_specialized = true);     \
+  static T value() { return V; }      \
+  static T tolerance()                \
+{ return (std::max)(E, static_cast<T>(5*std::numeric_limits<T>::epsilon())); } \
+};
+// (The extra static_cast<T> in the std::max call above is actually
+// unnecessary except for HP aCC 1.30, which claims that
+// numeric_limits<double>::epsilon() doesn't actually return a double.)
+
+BOOST_RANDOM_FIBONACCI_VAL(double, 607, 273, 0.4293817707235914, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 1279, 418, 0.9421630240437659, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 2281, 1252, 0.1768114046909004, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 3217, 576, 0.1956232694868209, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 4423, 2098, 0.9499762202147172, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 9689, 5502, 0.05737836943695162, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 19937, 9842, 0.5076528587449834, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 23209, 13470, 0.5414473810619185, 1e-14)
+BOOST_RANDOM_FIBONACCI_VAL(double, 44497,21034, 0.254135073399297, 1e-14)
+
+#undef BOOST_RANDOM_FIBONACCI_VAL
+
+/// \endcond
+
+/**
+ * Instantiations of class template @c lagged_fibonacci_01 model a
+ * \pseudo_random_number_generator. It uses a lagged Fibonacci
+ * algorithm with two lags @c p and @c q, evaluated in floating-point
+ * arithmetic: x(i) = x(i-p) + x(i-q) (mod 1) with p > q. See
+ *
+ *  @blockquote
+ *  "Uniform random number generators for supercomputers", Richard Brent,
+ *  Proc. of Fifth Australian Supercomputer Conference, Melbourne,
+ *  Dec. 1992, pp. 704-706.
+ *  @endblockquote
+ *
+ * @xmlnote
+ * 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 \lagged_fibonacci607 instead.
+ * @endxmlnote
+ *
+ * The generator requires considerable amounts of memory for the storage
+ * of its state array. For example, \lagged_fibonacci607 requires about
+ * 4856 bytes and \lagged_fibonacci44497 requires about 350 KBytes.
+ */
+template<class RealType, int w, unsigned int p, unsigned int q>
+class lagged_fibonacci_01
+{
+public:
+  typedef RealType result_type;
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  BOOST_STATIC_CONSTANT(int, word_size = w);
+  BOOST_STATIC_CONSTANT(unsigned int, long_lag = p);
+  BOOST_STATIC_CONSTANT(unsigned int, short_lag = q);
+
+  /** Constructs a @c lagged_fibonacci_01 generator and calls @c seed(). */
+  lagged_fibonacci_01() { init_modulus(); seed(); }
+  /** Constructs a @c lagged_fibonacci_01 generator and calls @c seed(value). */
+  BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(lagged_fibonacci_01, uint32_t, value)
+  { init_modulus(); seed(value); }
+  /** Constructs a @c lagged_fibonacci_01 generator and calls @c seed(gen). */
+  BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(lagged_fibonacci_01, Generator, gen)
+  { init_modulus(); seed(gen); }
+  template<class It> lagged_fibonacci_01(It& first, It last)
+  { init_modulus(); seed(first, last); }
+  // compiler-generated copy ctor and assignment operator are fine
+
+private:
+  /// \cond hide_private_members
+  void init_modulus()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::pow;
+#endif
+    _modulus = pow(RealType(2), word_size);
+  }
+  /// \endcond
+
+public:
+  /** Calls seed(331u). */
+  void seed() { seed(331u); }
+  /**
+   * Constructs a \minstd_rand0 generator with the constructor parameter
+   * value and calls seed with it. Distinct seeds in the range
+   * [1, 2147483647) will produce generators with different states. Other
+   * seeds will be equivalent to some seed within this range. See
+   * \linear_congruential for details.
+   */
+  BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(lagged_fibonacci_01, uint32_t, value)
+  {
+    minstd_rand0 intgen(value);
+    seed(intgen);
+  }
+
+  /**
+   * Sets the state of this @c lagged_fibonacci_01 to the values returned
+   * by p invocations of \uniform_01<code>\<RealType\>()(gen)</code>.
+   *
+   * Complexity: Exactly p invocations of gen.
+   */
+  BOOST_RANDOM_DETAIL_GENERATOR_SEED(lagged_fibonacci, Generator, gen)
+  {
+    // use pass-by-reference, but wrap argument in pass_through_engine
+    typedef detail::pass_through_engine<Generator&> ref_gen;
+    uniform_01<ref_gen, RealType> gen01 =
+      uniform_01<ref_gen, RealType>(ref_gen(gen));
+    // I could have used std::generate_n, but it takes "gen" by value
+    for(unsigned int j = 0; j < long_lag; ++j)
+      x[j] = gen01();
+    i = long_lag;
+  }
+
+  template<class It>
+  void seed(It& first, It last)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::fmod;
+    using std::pow;
+#endif
+    unsigned long mask = ~((~0u) << (w%32));   // now lowest w bits set
+    RealType two32 = pow(RealType(2), 32);
+    unsigned int j;
+    for(j = 0; j < long_lag && first != last; ++j) {
+      x[j] = RealType(0);
+      for(int k = 0; k < w/32 && first != last; ++k, ++first)
+        x[j] += *first / pow(two32,k+1);
+      if(first != last && mask != 0) {
+        x[j] += fmod((*first & mask) / _modulus, RealType(1));
+        ++first;
+      }
+    }
+    i = long_lag;
+    if(first == last && j < long_lag)
+      throw std::invalid_argument("lagged_fibonacci_01::seed");
+  }
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
+
+  result_type operator()()
+  {
+    if(i >= long_lag)
+      fill();
+    return x[i++];
+  }
+
+  static bool validation(result_type x)
+  {
+    result_type v = fibonacci_validation<result_type, p, q>::value();
+    result_type epsilon = fibonacci_validation<result_type, p, q>::tolerance();
+    // std::abs is a source of trouble: sometimes, it's not overloaded
+    // for double, plus the usual namespace std noncompliance -> avoid it
+    // using std::abs;
+    // return abs(x - v) < 5 * epsilon
+    return x > v - epsilon && x < v + epsilon;
+  }
+  
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci_01&f)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::pow;
+#endif
+    os << f.i << " ";
+    std::ios_base::fmtflags oldflags = os.flags(os.dec | os.fixed | os.left); 
+    for(unsigned int i = 0; i < f.long_lag; ++i)
+      os << f.x[i] * f._modulus << " ";
+    os.flags(oldflags);
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT, Traits>&
+  operator>>(std::basic_istream<CharT, Traits>& is, lagged_fibonacci_01& f)
+    {
+# ifdef BOOST_RANDOM_EXTRACT_LF
+        return detail::extract_lagged_fibonacci_01(is, f, f.i, f.x, f._modulus);
+# else
+        is >> f.i >> std::ws;
+        for(unsigned int i = 0; i < f.long_lag; ++i) {
+            typename lagged_fibonacci_01::result_type value;
+            is >> value >> std::ws;
+            f.x[i] = value / f._modulus;
+        }
+        return is;
+# endif 
+    }
+#endif
+
+  friend bool operator==(const lagged_fibonacci_01& x,
+                         const lagged_fibonacci_01& y)
+  { return x.i == y.i && std::equal(x.x, x.x+long_lag, y.x); }
+  friend bool operator!=(const lagged_fibonacci_01& x,
+                         const lagged_fibonacci_01& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const lagged_fibonacci_01& rhs) const
+  { return i == rhs.i && std::equal(x, x+long_lag, rhs.x); }
+  bool operator!=(const lagged_fibonacci_01& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  /// \cond hide_private_members
+  void fill();
+  /// \endcond
+  unsigned int i;
+  RealType x[long_lag];
+  RealType _modulus;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class RealType, int w, unsigned int p, unsigned int q>
+const bool lagged_fibonacci_01<RealType, w, p, q>::has_fixed_range;
+template<class RealType, int w, unsigned int p, unsigned int q>
+const unsigned int lagged_fibonacci_01<RealType, w, p, q>::long_lag;
+template<class RealType, int w, unsigned int p, unsigned int q>
+const unsigned int lagged_fibonacci_01<RealType, w, p, q>::short_lag;
+template<class RealType, int w, unsigned int p, unsigned int q>
+const int lagged_fibonacci_01<RealType,w,p,q>::word_size;
+
+#endif
+
+/// \cond hide_private_members
+template<class RealType, int w, unsigned int p, unsigned int q>
+void lagged_fibonacci_01<RealType, w, p, q>::fill()
+{
+  // two loops to avoid costly modulo operations
+  {  // extra scope for MSVC brokenness w.r.t. for scope
+  for(unsigned int j = 0; j < short_lag; ++j) {
+    RealType t = x[j] + x[j+(long_lag-short_lag)];
+    if(t >= RealType(1))
+      t -= RealType(1);
+    x[j] = t;
+  }
+  }
+  for(unsigned int j = short_lag; j < long_lag; ++j) {
+    RealType t = x[j] + x[j-short_lag];
+    if(t >= RealType(1))
+      t -= RealType(1);
+    x[j] = t;
+  }
+  i = 0;
+}
+/// \endcond
+
+} // namespace random
+
+#ifdef BOOST_RANDOM_DOXYGEN
+namespace detail {
+/**
+ * The specializations lagged_fibonacci607 ... lagged_fibonacci44497
+ * use well tested lags.
+ *
+ * See
+ *
+ *  @blockquote
+ *  "On the Periods of Generalized Fibonacci Recurrences", Richard P. Brent
+ *  Computer Sciences Laboratory Australian National University, December 1992
+ *  @endblockquote
+ *
+ * The lags used here can be found in
+ *
+ *  @blockquote
+ *  "Uniform random number generators for supercomputers", Richard Brent,
+ *  Proc. of Fifth Australian Supercomputer Conference, Melbourne,
+ *  Dec. 1992, pp. 704-706.
+ *  @endblockquote
+ */
+struct lagged_fibonacci_doc {};
+}
+#endif
+
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 607, 273> lagged_fibonacci607;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 1279, 418> lagged_fibonacci1279;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 2281, 1252> lagged_fibonacci2281;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 3217, 576> lagged_fibonacci3217;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 4423, 2098> lagged_fibonacci4423;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 9689, 5502> lagged_fibonacci9689;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 19937, 9842> lagged_fibonacci19937;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 23209, 13470> lagged_fibonacci23209;
+/**
+ * @copydoc boost::detail::lagged_fibonacci_doc
+ */
+typedef random::lagged_fibonacci_01<double, 48, 44497, 21034> lagged_fibonacci44497;
+
+
+// It is possible to partially specialize uniform_01<> on lagged_fibonacci_01<>
+// to help the compiler generate efficient code.  For GCC, this seems useless,
+// because GCC optimizes (x-0)/(1-0) to (x-0).  This is good enough for now.
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_LAGGED_FIBONACCI_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_congruential.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_congruential.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_congruential.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_congruential.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,403 @@
+/* boost random/linear_congruential.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: linear_congruential.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
+#define BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
+
+#include <iostream>
+#include <cassert>
+#include <stdexcept>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/const_mod.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/random/detail/disable_warnings.hpp>
+
+namespace boost {
+namespace random {
+
+/**
+ * Instantiations of class template linear_congruential model a
+ * \pseudo_random_number_generator. Linear congruential pseudo-random
+ * number generators are described in:
+ *
+ *  "Mathematical methods in large-scale computing units", D. H. Lehmer,
+ *  Proc. 2nd Symposium on Large-Scale Digital Calculating Machines,
+ *  Harvard University Press, 1951, pp. 141-146
+ *
+ * Let x(n) denote the sequence of numbers returned by some pseudo-random
+ * number generator. Then for the linear congruential generator,
+ * x(n+1) := (a * x(n) + c) mod m. Parameters for the generator are
+ * x(0), a, c, m. The template parameter IntType shall denote an integral
+ * type. It must be large enough to hold values a, c, and m. The template
+ * parameters a and c must be smaller than m.
+ *
+ * Note: The quality of the generator crucially depends on the choice of
+ * the parameters. User code should use one of the sensibly parameterized
+ * generators such as minstd_rand instead.
+ */
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+class linear_congruential
+{
+public:
+  typedef IntType result_type;
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+  static const bool has_fixed_range = true;
+  static const result_type min_value = ( c == 0 ? 1 : 0 );
+  static const result_type max_value = m-1;
+#else
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+#endif
+  BOOST_STATIC_CONSTANT(IntType, multiplier = a);
+  BOOST_STATIC_CONSTANT(IntType, increment = c);
+  BOOST_STATIC_CONSTANT(IntType, modulus = m);
+
+  // MSVC 6 and possibly others crash when encountering complicated integral
+  // constant expressions.  Avoid the check for now.
+  // BOOST_STATIC_ASSERT(m == 0 || a < m);
+  // BOOST_STATIC_ASSERT(m == 0 || c < m);
+
+  /**
+   * Constructs a linear_congruential generator, seeding it with @c x0.
+   */
+  explicit linear_congruential(IntType x0 = 1)
+  { 
+    seed(x0);
+
+    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
+#endif
+  }
+
+  /**
+   * Constructs a @c linear_congruential generator and seeds it
+   * with values taken from the itrator range [first, last)
+   * and adjusts first to point to the element after the last one
+   * used.  If there are not enough elements, throws @c std::invalid_argument.
+   *
+   * first and last must be input iterators.
+   */
+  template<class It>
+  linear_congruential(It& first, It last)
+  {
+      seed(first, last);
+  }
+
+  // compiler-generated copy constructor and assignment operator are fine
+
+  /**
+   * If c mod m is zero and x0 mod m is zero, changes the current value of
+   * the generator to 1. Otherwise, changes it to x0 mod m. If c is zero,
+   * distinct seeds in the range [1,m) will leave the generator in distinct
+   * states. If c is not zero, the range is [0,m).
+   */
+  void seed(IntType x0 = 1)
+  {
+    // wrap _x if it doesn't fit in the destination
+    if(modulus == 0) {
+      _x = x0;
+    } else {
+      _x = x0 % modulus;
+    }
+    // handle negative seeds
+    if(_x <= 0 && _x != 0) {
+      _x += modulus;
+    }
+    // adjust to the correct range
+    if(increment == 0 && _x == 0) {
+      _x = 1;
+    }
+    assert(_x >= (min)());
+    assert(_x <= (max)());
+  }
+
+  /**
+   * seeds a @c linear_congruential generator with values taken
+   * from the itrator range [first, last) and adjusts @c first to
+   * point to the element after the last one used.  If there are
+   * not enough elements, throws @c std::invalid_argument.
+   *
+   * @c first and @c last must be input iterators.
+   */
+  template<class It>
+  void seed(It& first, It last)
+  {
+    if(first == last)
+      throw std::invalid_argument("linear_congruential::seed");
+    seed(*first++);
+  }
+
+  /**
+   * Returns the smallest value that the @c linear_congruential generator
+   * can produce.
+   */
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return c == 0 ? 1 : 0; }
+  /**
+   * Returns the largest value that the @c linear_congruential generator
+   * can produce.
+   */
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return modulus-1; }
+
+  /** Returns the next value of the @c linear_congruential generator. */
+  IntType operator()()
+  {
+    _x = const_mod<IntType, m>::mult_add(a, _x, c);
+    return _x;
+  }
+
+  static bool validation(IntType x) { return val == x; }
+
+#ifdef BOOST_NO_OPERATORS_IN_NAMESPACE
+    
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const linear_congruential& rhs) const
+  { return _x == rhs._x; }
+  bool operator!=(const linear_congruential& rhs) const
+  { return !(*this == rhs); }
+
+#else 
+  friend bool operator==(const linear_congruential& x,
+                         const linear_congruential& y)
+  { return x._x == y._x; }
+  friend bool operator!=(const linear_congruential& x,
+                         const linear_congruential& y)
+  { return !(x == y); }
+    
+#if !defined(BOOST_RANDOM_NO_STREAM_OPERATORS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os,
+             const linear_congruential& lcg)
+  {
+    return os << lcg._x;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is,
+             linear_congruential& lcg)
+  {
+    return is >> lcg._x;
+  }
+ 
+private:
+#endif
+#endif
+
+  IntType _x;
+};
+
+// probably needs the "no native streams" caveat for STLPort
+#if !defined(__SGI_STL_PORT) && BOOST_WORKAROUND(__GNUC__, == 2)
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+std::ostream&
+operator<<(std::ostream& os,
+           const linear_congruential<IntType,a,c,m,val>& lcg)
+{
+    return os << lcg._x;
+}
+
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+std::istream&
+operator>>(std::istream& is,
+           linear_congruential<IntType,a,c,m,val>& lcg)
+{
+    return is >> lcg._x;
+}
+#elif defined(BOOST_RANDOM_NO_STREAM_OPERATORS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val>
+std::basic_ostream<CharT,Traits>&
+operator<<(std::basic_ostream<CharT,Traits>& os,
+           const linear_congruential<IntType,a,c,m,val>& lcg)
+{
+    return os << lcg._x;
+}
+
+template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val>
+std::basic_istream<CharT,Traits>&
+operator>>(std::basic_istream<CharT,Traits>& is,
+           linear_congruential<IntType,a,c,m,val>& lcg)
+{
+    return is >> lcg._x;
+}
+#endif
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+const bool linear_congruential<IntType, a, c, m, val>::has_fixed_range;
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+const typename linear_congruential<IntType, a, c, m, val>::result_type linear_congruential<IntType, a, c, m, val>::min_value;
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+const typename linear_congruential<IntType, a, c, m, val>::result_type linear_congruential<IntType, a, c, m, val>::max_value;
+template<class IntType, IntType a, IntType c, IntType m, IntType val>
+const IntType linear_congruential<IntType,a,c,m,val>::modulus;
+#endif
+
+} // namespace random
+
+// validation values from the publications
+/**
+ * The specialization \minstd_rand0 was originally suggested in
+ *
+ *  @blockquote
+ *  A pseudo-random number generator for the System/360, P.A. Lewis,
+ *  A.S. Goodman, J.M. Miller, IBM Systems Journal, Vol. 8, No. 2,
+ *  1969, pp. 136-146
+ *  @endblockquote
+ *
+ * It is examined more closely together with \minstd_rand in
+ *
+ *  @blockquote
+ *  "Random Number Generators: Good ones are hard to find",
+ *  Stephen K. Park and Keith W. Miller, Communications of
+ *  the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201 
+ *  @endblockquote
+ */
+typedef random::linear_congruential<int32_t, 16807, 0, 2147483647, 
+  1043618065> minstd_rand0;
+
+/** The specialization \minstd_rand was suggested in
+ *
+ *  @blockquote
+ *  "Random Number Generators: Good ones are hard to find",
+ *  Stephen K. Park and Keith W. Miller, Communications of
+ *  the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201
+ *  @endblockquote
+ */
+typedef random::linear_congruential<int32_t, 48271, 0, 2147483647,
+  399268537> minstd_rand;
+
+
+#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
+/** Class @c rand48 models a \pseudo_random_number_generator. It uses
+ * the linear congruential algorithm with the parameters a = 0x5DEECE66D,
+ * c = 0xB, m = 2**48. It delivers identical results to the @c lrand48()
+ * function available on some systems (assuming lcong48 has not been called).
+ *
+ * It is only available on systems where @c uint64_t is provided as an
+ * integral type, so that for example static in-class constants and/or
+ * enum definitions with large @c uint64_t numbers work.
+ */
+class rand48 
+{
+public:
+  typedef int32_t result_type;
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+  static const bool has_fixed_range = true;
+  static const int32_t min_value = 0;
+  static const int32_t max_value = integer_traits<int32_t>::const_max;
+#else
+  enum { has_fixed_range = false };
+#endif
+  /**
+   * Returns the smallest value that the generator can produce
+   */
+  int32_t min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
+  /**
+   * Returns the largest value that the generator can produce
+   */
+  int32_t max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return std::numeric_limits<int32_t>::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
+  
+#ifdef BOOST_RANDOM_DOXYGEN
+  /**
+   * If T is an integral type smaller than int46_t, constructs
+   * a \rand48 generator with x(0) := (x0 << 16) | 0x330e.  Otherwise
+   * constructs a \rand48 generator with x(0) = x0.
+   */
+  template<class T> explicit rand48(T x0 = 1);
+#else
+  rand48() : lcf(cnv(static_cast<int32_t>(1))) {}
+  template<class T> explicit rand48(T x0) : lcf(cnv(x0)) { }
+#endif
+  template<class It> rand48(It& first, It last) : lcf(first, last) { }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+#ifdef BOOST_RANDOM_DOXYGEN
+  /**
+   * If T is an integral type smaller than int46_t, changes
+   * the current value x(n) of the generator to (x0 << 16) | 0x330e.
+   * Otherwise changes the current value x(n) to x0.
+   */
+  template<class T> void seed(T x0 = 1);
+#else
+  void seed() { seed(static_cast<int32_t>(1)); }
+  template<class T> void seed(T x0) { lcf.seed(cnv(x0)); }
+#endif
+  template<class It> void seed(It& first, It last) { lcf.seed(first,last); }
+
+  /**
+   * Returns the next value of the generator.
+   */
+  int32_t operator()() { return static_cast<int32_t>(lcf() >> 17); }
+  // by experiment from lrand48()
+  static bool validation(int32_t x) { return x == 1993516219; }
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT,class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const rand48& r)
+  { os << r.lcf; return os; }
+
+  template<class CharT,class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, rand48& r)
+  { is >> r.lcf; return is; }
+#endif
+
+  friend bool operator==(const rand48& x, const rand48& y)
+  { return x.lcf == y.lcf; }
+  friend bool operator!=(const rand48& x, const rand48& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const rand48& rhs) const
+  { return lcf == rhs.lcf; }
+  bool operator!=(const rand48& rhs) const
+  { return !(*this == rhs); }
+#endif
+private:
+  /// \cond hide_private_members
+  random::linear_congruential<uint64_t,
+    uint64_t(0xDEECE66DUL) | (uint64_t(0x5) << 32), // xxxxULL is not portable
+    0xB, uint64_t(1)<<48, /* unknown */ 0> lcf;
+  template<class T>
+  static uint64_t cnv(T x) 
+  {
+    if(sizeof(T) < sizeof(uint64_t)) {
+      return (static_cast<uint64_t>(x) << 16) | 0x330e;
+    } else {
+      return(static_cast<uint64_t>(x));
+    }
+  }
+  static uint64_t cnv(float x) { return(static_cast<uint64_t>(x)); }
+  static uint64_t cnv(double x) { return(static_cast<uint64_t>(x)); }
+  static uint64_t cnv(long double x) { return(static_cast<uint64_t>(x)); }
+  /// \endcond
+};
+#endif /* !BOOST_NO_INT64_T && !BOOST_NO_INTEGRAL_INT64_T */
+
+} // namespace boost
+
+#include <boost/random/detail/enable_warnings.hpp>
+
+#endif // BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_feedback_shift.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_feedback_shift.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_feedback_shift.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_feedback_shift.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,160 @@
+/* boost random/tausworthe.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: linear_feedback_shift.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ */
+
+#ifndef BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
+#define BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
+
+#include <iostream>
+#include <cassert>
+#include <stdexcept>
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/limits.hpp>
+#include <boost/random/detail/config.hpp>
+
+namespace boost {
+namespace random {
+
+/**
+ * Instatiation of @c linear_feedback_shift model a
+ * \pseudo_random_number_generator.  It was originally
+ * proposed in
+ *
+ *  @blockquote
+ *  "Random numbers generated by linear recurrence modulo two.",
+ *  Tausworthe, R. C.(1965), Mathematics of Computation 19, 201-209.
+ *  @endblockquote
+ */
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+class linear_feedback_shift
+{
+public:
+  typedef UIntType result_type;
+  // avoid the warning trouble when using (1<<w) on 32 bit machines
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  BOOST_STATIC_CONSTANT(int, word_size = w);
+  BOOST_STATIC_CONSTANT(int, exponent1 = k);
+  BOOST_STATIC_CONSTANT(int, exponent2 = q);
+  BOOST_STATIC_CONSTANT(int, step_size = s);
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return wordmask; }
+
+  // MSVC 6 and possibly others crash when encountering complicated integral
+  // constant expressions.  Avoid the checks for now.
+  // BOOST_STATIC_ASSERT(w > 0);
+  // BOOST_STATIC_ASSERT(q > 0);
+  // BOOST_STATIC_ASSERT(k < w);
+  // BOOST_STATIC_ASSERT(0 < 2*q && 2*q < k);
+  // BOOST_STATIC_ASSERT(0 < s && s <= k-q);
+
+  explicit linear_feedback_shift(UIntType s0 = 341) : wordmask(0)
+  {
+    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(std::numeric_limits<UIntType>::is_integer);
+    BOOST_STATIC_ASSERT(!std::numeric_limits<UIntType>::is_signed);
+#endif
+
+    // avoid "left shift count >= with of type" warning
+    for(int i = 0; i < w; ++i)
+      wordmask |= (1u << i);
+    seed(s0);
+  }
+
+  template<class It> linear_feedback_shift(It& first, It last) : wordmask(0)
+  {
+    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(std::numeric_limits<UIntType>::is_integer);
+    BOOST_STATIC_ASSERT(!std::numeric_limits<UIntType>::is_signed);
+#endif
+
+    // avoid "left shift count >= with of type" warning
+    for(int i = 0; i < w; ++i)
+      wordmask |= (1u << i);
+    seed(first, last);
+  }
+
+  void seed(UIntType s0 = 341) {
+      if(s0 < (1 << (w-k))) {
+          s0 += 1 << (w-k);
+      }
+      value = s0;
+  }
+  template<class It> void seed(It& first, It last)
+  {
+    if(first == last)
+      throw std::invalid_argument("linear_feedback_shift::seed");
+    value = *first++;
+    assert(value >= (1 << (w-k)));
+  }
+
+  result_type operator()()
+  {
+    const UIntType b = (((value << q) ^ value) & wordmask) >> (k-s);
+    const UIntType mask = ( (~static_cast<UIntType>(0)) << (w-k) ) & wordmask;
+    value = ((value & mask) << s) ^ b;
+    return value;
+  }
+  static bool validation(result_type x) { return val == x; }
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, linear_feedback_shift x)
+  { os << x.value; return os; }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, linear_feedback_shift& x)
+  { is >> x.value; return is; }
+#endif
+
+  friend bool operator==(linear_feedback_shift x, linear_feedback_shift y)
+  { return x.value == y.value; }
+  friend bool operator!=(linear_feedback_shift x, linear_feedback_shift y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(linear_feedback_shift rhs) const
+  { return value == rhs.value; }
+  bool operator!=(linear_feedback_shift rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  UIntType wordmask; // avoid "left shift count >= width of type" warnings
+  UIntType value;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+const bool linear_feedback_shift<UIntType, w, k, q, s, val>::has_fixed_range;
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+const int linear_feedback_shift<UIntType, w, k, q, s, val>::word_size;
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+const int linear_feedback_shift<UIntType, w, k, q, s, val>::exponent1;
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+const int linear_feedback_shift<UIntType, w, k, q, s, val>::exponent2;
+template<class UIntType, int w, int k, int q, int s, UIntType val>
+const int linear_feedback_shift<UIntType, w, k, q, s, val>::step_size;
+#endif
+
+} // namespace random
+} // namespace boost
+
+#endif // BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lognormal_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lognormal_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lognormal_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lognormal_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,129 @@
+/* boost random/lognormal_distribution.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: lognormal_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP
+#define BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>      // std::exp, std::sqrt
+#include <cassert>
+#include <iostream>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/normal_distribution.hpp>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+  using ::log;
+  using ::sqrt;
+}
+#endif
+
+namespace boost {
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+// Special gcc workaround: gcc 2.95.x ignores using-declarations
+// in template classes (confirmed by gcc author Martin v. Loewis)
+  using std::sqrt;
+  using std::exp;
+#endif
+
+/**
+ * Instantiations of class template lognormal_distribution model a
+ * \random_distribution. Such a distribution produces random numbers
+ * with \f$p(x) = \frac{1}{x \sigma_N \sqrt{2\pi}} e^{\frac{-\left(\log(x)-\mu_N\right)^2}{2\sigma_N^2}}\f$
+ * for x > 0, where \f$\mu_N = \log\left(\frac{\mu^2}{\sqrt{\sigma^2 + \mu^2}}\right)\f$ and
+ * \f$\sigma_N = \sqrt{\log\left(1 + \frac{\sigma^2}{\mu^2}\right)}\f$.
+ */
+template<class RealType = double>
+class lognormal_distribution
+{
+public:
+  typedef typename normal_distribution<RealType>::input_type input_type;
+  typedef RealType result_type;
+
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
+#endif
+
+  /**
+   * Constructs a lognormal_distribution. @c mean and @c sigma are the
+   * mean and standard deviation of the lognormal distribution.
+   */
+  explicit lognormal_distribution(result_type mean_arg = result_type(1),
+                                  result_type sigma_arg = result_type(1))
+    : _mean(mean_arg), _sigma(sigma_arg)
+  { 
+    assert(_mean > result_type(0));
+    init();
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  RealType mean() const { return _mean; }
+  RealType sigma() const { return _sigma; }
+  void reset() { _normal.reset(); }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::exp;
+#endif
+    return exp(_normal(eng) * _nsigma + _nmean);
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const lognormal_distribution& ld)
+  {
+    os << ld._normal << " " << ld._mean << " " << ld._sigma;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, lognormal_distribution& ld)
+  {
+    is >> std::ws >> ld._normal >> std::ws >> ld._mean >> std::ws >> ld._sigma;
+    ld.init();
+    return is;
+  }
+#endif
+
+private:
+
+  /// \cond hide_private_members
+  void init()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::exp; using std::log; using std::sqrt;
+#endif
+    _nmean = log(_mean*_mean/sqrt(_sigma*_sigma + _mean*_mean));
+    _nsigma = sqrt(log(_sigma*_sigma/_mean/_mean+result_type(1)));
+  }
+  /// \endcond
+
+  RealType _mean, _sigma;
+  RealType _nmean, _nsigma;
+  normal_distribution<result_type> _normal;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP