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 [9/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/mersenne_twister.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/mersenne_twister.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/mersenne_twister.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/mersenne_twister.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,367 @@
+/* boost random/mersenne_twister.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: mersenne_twister.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_MERSENNE_TWISTER_HPP
+#define BOOST_RANDOM_MERSENNE_TWISTER_HPP
+
+#include <iostream>
+#include <algorithm>     // std::copy
+#include <stdexcept>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/ptr_helper.hpp>
+#include <boost/random/detail/seed.hpp>
+
+namespace boost {
+namespace random {
+
+/**
+ * Instantiations of class template mersenne_twister 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. 
+ *  @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, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+class mersenne_twister
+{
+public:
+  typedef UIntType result_type;
+  BOOST_STATIC_CONSTANT(int, word_size = w);
+  BOOST_STATIC_CONSTANT(int, state_size = n);
+  BOOST_STATIC_CONSTANT(int, shift_size = m);
+  BOOST_STATIC_CONSTANT(int, mask_bits = r);
+  BOOST_STATIC_CONSTANT(UIntType, parameter_a = a);
+  BOOST_STATIC_CONSTANT(int, output_u = u);
+  BOOST_STATIC_CONSTANT(int, output_s = s);
+  BOOST_STATIC_CONSTANT(UIntType, output_b = b);
+  BOOST_STATIC_CONSTANT(int, output_t = t);
+  BOOST_STATIC_CONSTANT(UIntType, output_c = c);
+  BOOST_STATIC_CONSTANT(int, output_l = l);
+
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  
+  /**
+   * Constructs a @c mersenne_twister and calls @c seed().
+   */
+  mersenne_twister() { seed(); }
+
+  /**
+   * Constructs a @c mersenne_twister and calls @c seed(value).
+   */
+  BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister, UIntType, value)
+  { seed(value); }
+  template<class It> mersenne_twister(It& first, It last) { seed(first,last); }
+
+  /**
+   * Constructs a mersenne_twister and calls @c seed(gen).
+   *
+   * @xmlnote
+   * The copy constructor will always be preferred over
+   * the templated constructor.
+   * @endxmlnote
+   */
+  BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(mersenne_twister, Generator, gen)
+  { seed(gen); }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /** Calls @c seed(result_type(5489)). */
+  void seed() { seed(UIntType(5489)); }
+
+  /**
+   * Sets the state x(0) to v mod 2w. Then, iteratively,
+   * sets x(i) to (i + 1812433253 * (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, UIntType, value)
+  {
+    // 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 = ~0u;
+    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] = (1812433253UL * (x[i-1] ^ (x[i-1] >> (w-2))) + i) & mask;
+    }
+  }
+
+  /**
+   * Sets the state of this mersenne_twister to the values
+   * returned by n invocations of gen.
+   *
+   * Complexity: Exactly n invocations of gen.
+   */
+  BOOST_RANDOM_DETAIL_GENERATOR_SEED(mersenne_twister, Generator, gen)
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(!std::numeric_limits<result_type>::is_signed);
+#endif
+    // I could have used std::generate_n, but it takes "gen" by value
+    for(int j = 0; j < n; j++)
+      x[j] = gen();
+    i = n;
+  }
+
+  template<class It>
+  void seed(It& first, It last)
+  {
+    int j;
+    for(j = 0; j < n && first != last; ++j, ++first)
+      x[j] = *first;
+    i = n;
+    if(first == last && j < n)
+      throw std::invalid_argument("mersenne_twister::seed");
+  }
+  
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
+  {
+    // avoid "left shift count >= with of type" warning
+    result_type res = 0;
+    for(int j = 0; j < w; ++j)
+      res |= (1u << j);
+    return res;
+  }
+
+  result_type operator()();
+  static bool validation(result_type v) { return val == v; }
+
+#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 mersenne_twister& mt)
+  {
+    for(int j = 0; j < mt.state_size; ++j)
+      os << mt.compute(j) << " ";
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, mersenne_twister& mt)
+  {
+    for(int 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
+
+  friend bool operator==(const mersenne_twister& x, const mersenne_twister& y)
+  {
+    for(int j = 0; j < state_size; ++j)
+      if(x.compute(j) != y.compute(j))
+        return false;
+    return true;
+  }
+
+  friend bool operator!=(const mersenne_twister& x, const mersenne_twister& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const mersenne_twister& rhs) const
+  {
+    for(int j = 0; j < state_size; ++j)
+      if(compute(j) != rhs.compute(j))
+        return false;
+    return true;
+  }
+
+  bool operator!=(const mersenne_twister& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  /// \cond hide_private_members
+  // returns x(i-n+index), where index is in 0..n-1
+  UIntType compute(unsigned int index) const
+  {
+    // equivalent to (i-n+index) % 2n, but doesn't produce negative numbers
+    return x[ (i + n + index) % (2*n) ];
+  }
+  void twist(int block);
+  /// \endcond
+
+  // state representation: next output is o(x(i))
+  //   x[0]  ... x[k] x[k+1] ... x[n-1]     x[n]     ... x[2*n-1]   represents
+  //  x(i-k) ... x(i) x(i+1) ... x(i-k+n-1) x(i-k-n) ... x[i(i-k-1)]
+  // The goal is to always have x(i-n) ... x(i-1) available for
+  // operator== and save/restore.
+
+  UIntType x[2*n]; 
+  int i;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const bool mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::has_fixed_range;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::state_size;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::shift_size;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::mask_bits;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::parameter_a;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_u;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_s;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_b;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_t;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_c;
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_l;
+#endif
+
+/// \cond hide_private_members
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+void mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::twist(int block)
+{
+  const UIntType upper_mask = (~0u) << r;
+  const UIntType lower_mask = ~upper_mask;
+
+  if(block == 0) {
+    for(int j = n; j < 2*n; j++) {
+      UIntType y = (x[j-n] & upper_mask) | (x[j-(n-1)] & lower_mask);
+      x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0);
+    }
+  } else if (block == 1) {
+    // split loop to avoid costly modulo operations
+    {  // extra scope for MSVC brokenness w.r.t. for scope
+      for(int j = 0; j < n-m; j++) {
+        UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask);
+        x[j] = x[j+n+m] ^ (y >> 1) ^ (y&1 ? a : 0);
+      }
+    }
+    
+    for(int j = n-m; j < n-1; j++) {
+      UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask);
+      x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0);
+    }
+    // last iteration
+    UIntType y = (x[2*n-1] & upper_mask) | (x[0] & lower_mask);
+    x[n-1] = x[m-1] ^ (y >> 1) ^ (y&1 ? a : 0);
+    i = 0;
+  }
+}
+/// \endcond
+
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+  int s, UIntType b, int t, UIntType c, int l, UIntType val>
+inline typename mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::result_type
+mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::operator()()
+{
+  if(i == n)
+    twist(0);
+  else if(i >= 2*n)
+    twist(1);
+  // Step 4
+  UIntType z = x[i];
+  ++i;
+  z ^= (z >> u);
+  z ^= ((z << s) & b);
+  z ^= ((z << t) & c);
+  z ^= (z >> l);
+  return z;
+}
+
+} // namespace random
+
+/**
+ * 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. 
+ *  @endblockquote
+ */
+typedef random::mersenne_twister<uint32_t,32,351,175,19,0xccab8ee7,11,
+  7,0x31b6ab00,15,0xffe50000,17, 0xa37d3c92> 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. 
+ *  @endblockquote
+ */
+typedef random::mersenne_twister<uint32_t,32,624,397,31,0x9908b0df,11,
+  7,0x9d2c5680,15,0xefc60000,18, 3346425566U> mt19937;
+
+} // namespace boost
+
+BOOST_RANDOM_PTR_HELPER_SPEC(boost::mt19937)
+
+#endif // BOOST_RANDOM_MERSENNE_TWISTER_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/normal_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/normal_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/normal_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/normal_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,131 @@
+/* boost random/normal_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: normal_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_NORMAL_DISTRIBUTION_HPP
+#define BOOST_RANDOM_NORMAL_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 {
+
+/**
+ * Instantiations of class template normal_distribution model a
+ * \random_distribution. Such a distribution produces random numbers
+ * @c x distributed with probability density function
+ * \f$p(x) = \frac{1}{\sqrt{2\pi\sigma}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}\f$,
+ * where mean and sigma are the parameters of the distribution.
+ */
+// deterministic Box-Muller method, uses trigonometric functions
+template<class RealType = double>
+class normal_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
+
+  /**
+   * Constructs a normal_distribution object. @c mean and @c sigma are
+   * the parameters for the distribution.
+   *
+   * Requires: sigma > 0
+   */
+  explicit normal_distribution(const result_type& mean_arg = result_type(0),
+                               const result_type& sigma_arg = result_type(1))
+    : _mean(mean_arg), _sigma(sigma_arg), _valid(false)
+  {
+    assert(_sigma >= result_type(0));
+  }
+
+  // compiler-generated copy constructor is NOT fine, need to purge cache
+  normal_distribution(const normal_distribution& other)
+    : _mean(other._mean), _sigma(other._sigma), _valid(false)
+  {
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /**
+   * Returns: The "mean" parameter of the distribution.
+   */
+  RealType mean() const { return _mean; }
+  /**
+   * Returns: The "sigma" parameter of the distribution.
+   */
+  RealType sigma() const { return _sigma; }
+
+  void reset() { _valid = false; }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::sqrt; using std::log; using std::sin; using std::cos;
+#endif
+    if(!_valid) {
+      _r1 = eng();
+      _r2 = eng();
+      _cached_rho = sqrt(-result_type(2) * log(result_type(1)-_r2));
+      _valid = true;
+    } else {
+      _valid = false;
+    }
+    // Can we have a boost::mathconst please?
+    const result_type pi = result_type(3.14159265358979323846);
+    
+    return _cached_rho * (_valid ?
+                          cos(result_type(2)*pi*_r1) :
+                          sin(result_type(2)*pi*_r1))
+      * _sigma + _mean;
+  }
+
+#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 normal_distribution& nd)
+  {
+    os << nd._mean << " " << nd._sigma << " "
+       << nd._valid << " " << nd._cached_rho << " " << nd._r1;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, normal_distribution& nd)
+  {
+    is >> std::ws >> nd._mean >> std::ws >> nd._sigma
+       >> std::ws >> nd._valid >> std::ws >> nd._cached_rho
+       >> std::ws >> nd._r1;
+    return is;
+  }
+#endif
+private:
+  result_type _mean, _sigma;
+  result_type _r1, _r2, _cached_rho;
+  bool _valid;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_NORMAL_DISTRIBUTION_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/poisson_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/poisson_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/poisson_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/poisson_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,116 @@
+/* boost random/poisson_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: poisson_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ */
+
+#ifndef BOOST_RANDOM_POISSON_DISTRIBUTION_HPP
+#define BOOST_RANDOM_POISSON_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 {
+
+// Knuth
+
+/**
+ * An instantiation of the class template @c poisson_distribution is a
+ * model of \random_distribution.  The poisson distribution has
+ * \f$p(i) = \frac{e^{-\lambda}\lambda^i}{i!}\f$
+ */
+template<class IntType = int, class RealType = double>
+class poisson_distribution
+{
+public:
+  typedef RealType input_type;
+  typedef IntType result_type;
+
+  /**
+   * Constructs a @c poisson_distribution with the parameter @c mean.
+   *
+   * Requires: mean > 0
+   */
+  explicit poisson_distribution(const RealType& mean_arg = RealType(1))
+    : _mean(mean_arg)
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
+    BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
+    BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
+#endif
+
+    assert(_mean > RealType(0));
+    init();
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /**
+   * Returns: the "mean" parameter of the distribution.
+   */
+  RealType mean() const { return _mean; }
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+    // TODO: This is O(_mean), but it should be O(log(_mean)) for large _mean
+    RealType product = RealType(1);
+    for(result_type m = 0; ; ++m) {
+      product *= eng();
+      if(product <= _exp_mean)
+        return m;
+    }
+  }
+
+#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 poisson_distribution& pd)
+  {
+    os << pd._mean;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, poisson_distribution& pd)
+  {
+    is >> std::ws >> pd._mean;
+    pd.init();
+    return is;
+  }
+#endif
+
+private:
+  /// \cond hide_private_members
+  void init()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::exp;
+#endif
+    _exp_mean = exp(-_mean);
+  }
+  /// \endcond
+
+  RealType _mean;
+  // some precomputed data from the parameters
+  RealType _exp_mean;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_POISSON_DISTRIBUTION_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/random_number_generator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/random_number_generator.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/random_number_generator.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/random_number_generator.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,71 @@
+/* boost random/random_number_generator.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: random_number_generator.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_RANDOM_NUMBER_GENERATOR_HPP
+#define BOOST_RANDOM_RANDOM_NUMBER_GENERATOR_HPP
+
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/variate_generator.hpp>
+
+namespace boost {
+
+/**
+ * Instantiations of class template random_number_generator model a
+ * RandomNumberGenerator (std:25.2.11 [lib.alg.random.shuffle]). On
+ * each invocation, it returns a uniformly distributed integer in
+ * the range [0..n).
+ *
+ * The template parameter IntType shall denote some integer-like value type.
+ */
+template<class UniformRandomNumberGenerator, class IntType = long>
+class random_number_generator
+{
+public:
+  typedef UniformRandomNumberGenerator base_type;
+  typedef IntType argument_type;
+  typedef IntType result_type;
+  /**
+   * Constructs a random_number_generator functor with the given
+   * \uniform_random_number_generator as the underlying source of
+   * random numbers.
+   */
+  random_number_generator(base_type& rng) : _rng(rng)
+  { 
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_integer);
+#endif
+  }
+  // compiler-generated copy ctor is fine
+  // assignment is disallowed because there is a reference member
+
+  /**
+   * Returns a value in the range [0, n)
+   */
+  result_type operator()(argument_type n)
+  {
+    typedef uniform_int<IntType> dist_type;
+    return variate_generator<base_type&, dist_type>(_rng, dist_type(0, n-1))();
+  }
+
+private:
+  base_type& _rng;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_RANDOM_NUMBER_GENERATOR_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/ranlux.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/ranlux.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/ranlux.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/ranlux.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,81 @@
+/* boost random/ranlux.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: ranlux.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  created
+ */
+
+#ifndef BOOST_RANDOM_RANLUX_HPP
+#define BOOST_RANDOM_RANLUX_HPP
+
+#include <boost/config.hpp>
+#include <boost/random/subtract_with_carry.hpp>
+#include <boost/random/discard_block.hpp>
+
+namespace boost {
+
+namespace random {
+  typedef subtract_with_carry<int, (1<<24), 10, 24, 0> ranlux_base;
+  typedef subtract_with_carry_01<float, 24, 10, 24> ranlux_base_01;
+  typedef subtract_with_carry_01<double, 48, 10, 24> ranlux64_base_01;
+}
+
+namespace random {
+namespace detail {
+/**
+ * The ranlux family of generators are described in
+ *
+ *  @blockquote
+ *  "A portable high-quality random number generator for lattice field theory
+ *  calculations", M. Luescher, Computer Physics Communications, 79 (1994)
+ *  pp 100-110. 
+ *  @endblockquote
+ *
+ * The levels are given in
+ * 
+ *  @blockquote
+ *  "RANLUX: A Fortran implementation ofthe high-quality
+ *  pseudorandom number generator of Luescher", F. James,
+ *  Computer Physics Communications 79 (1994) 111-114
+ *  @endblockquote
+ */
+class ranlux_documentation {};
+}
+}
+
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux_base, 223, 24> ranlux3;
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux_base, 389, 24> ranlux4;
+
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux_base_01, 223, 24> ranlux3_01;
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux_base_01, 389, 24> ranlux4_01;
+
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux64_base_01, 223, 24> ranlux64_3_01;
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux64_base_01, 389, 24> ranlux64_4_01;
+
+#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
+namespace random {
+  typedef random::subtract_with_carry<int64_t, (int64_t(1)<<48), 10, 24, 0> ranlux64_base;
+}
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux64_base, 223, 24> ranlux64_3;
+/** @copydoc boost::random::detail::ranlux_documentation */
+typedef random::discard_block<random::ranlux64_base, 389, 24> ranlux64_4;
+#endif /* !BOOST_NO_INT64_T && !BOOST_NO_INTEGRAL_INT64_T */
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/shuffle_output.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/shuffle_output.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/shuffle_output.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/shuffle_output.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,234 @@
+/* boost random/shuffle_output.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: shuffle_output.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_SHUFFLE_OUTPUT_HPP
+#define BOOST_RANDOM_SHUFFLE_OUTPUT_HPP
+
+#include <iostream>
+#include <algorithm>     // std::copy
+#include <cassert>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/random/linear_congruential.hpp>
+
+namespace boost {
+namespace random {
+
+/**
+ * Instatiations of class template shuffle_output model a
+ * \pseudo_random_number_generator. It mixes the output
+ * of some (usually \linear_congruential) \uniform_random_number_generator
+ * to get better statistical properties.
+ * The algorithm is described in
+ *
+ *  @blockquote
+ *  "Improving a poor random number generator", Carter Bays
+ *  and S.D. Durham, ACM Transactions on Mathematical Software,
+ *  Vol 2, No. 1, March 1976, pp. 59-64.
+ *  http://doi.acm.org/10.1145/355666.355670
+ *  @endblockquote
+ *
+ * The output of the base generator is buffered in an array of
+ * length k. Every output X(n) has a second role: It gives an
+ * index into the array where X(n+1) will be retrieved. Used
+ * array elements are replaced with fresh output from the base
+ * generator.
+ *
+ * Template parameters are the base generator and the array
+ * length k, which should be around 100. The template parameter
+ * val is the validation value checked by validation.
+ */
+template<class UniformRandomNumberGenerator, int k,
+#ifndef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
+  typename UniformRandomNumberGenerator::result_type 
+#else
+  uint32_t
+#endif
+  val = 0>
+class shuffle_output
+{
+public:
+  typedef UniformRandomNumberGenerator base_type;
+  typedef typename base_type::result_type result_type;
+
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+  BOOST_STATIC_CONSTANT(int, buffer_size = k);
+
+  /**
+   * Constructs a @c shuffle_output generator by invoking the
+   * default constructor of the base generator.
+   *
+   * Complexity: Exactly k+1 invocations of the base generator.
+   */
+  shuffle_output() : _rng() { init(); }
+#if defined(BOOST_MSVC) && _MSC_VER < 1300
+  // MSVC does not implicitly generate the copy constructor here
+  shuffle_output(const shuffle_output & x)
+    : _rng(x._rng), y(x.y) { std::copy(x.v, x.v+k, v); }
+#endif
+  /**
+   * Constructs a shuffle_output generator by invoking the one-argument
+   * constructor of the base generator with the parameter seed.
+   *
+   * Complexity: Exactly k+1 invocations of the base generator.
+   */
+  template<class T>
+  explicit shuffle_output(T s) : _rng(s) { init(); }
+  /**
+   * Constructs a shuffle_output generator by using a copy
+   * of the provided generator.
+   *
+   * Precondition: The template argument UniformRandomNumberGenerator
+   * shall denote a CopyConstructible type.
+   *
+   * Complexity: Exactly k+1 invocations of the base generator.
+   */
+  explicit shuffle_output(const base_type & rng) : _rng(rng) { init(); }
+  template<class It> shuffle_output(It& first, It last)
+    : _rng(first, last) { init(); }
+  void seed() { _rng.seed(); init(); }
+  /**
+   * Invokes the one-argument seed method of the base generator
+   * with the parameter seed and re-initializes the internal buffer array.
+   *
+   * Complexity: Exactly k+1 invocations of the base generator.
+   */
+  template<class T>
+  void seed(T s) { _rng.seed(s); init(); }
+  template<class It> void seed(It& first, It last)
+  {
+    _rng.seed(first, last);
+    init();
+  }
+
+  const base_type& base() const { return _rng; }
+
+  result_type operator()() {
+    // calculating the range every time may seem wasteful.  However, this
+    // makes the information locally available for the optimizer.
+    result_type range = (max)()-(min)()+1;
+    int j = k*(y-(min)())/range;
+    // assert(0 <= j && j < k);
+    y = v[j];
+    v[j] = _rng();
+    return y;
+  }
+
+  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 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, const shuffle_output& s)
+  {
+    os << s._rng << " " << s.y << " ";
+    for(int i = 0; i < s.buffer_size; ++i)
+      os << s.v[i] << " ";
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, shuffle_output& s)
+  {
+    is >> s._rng >> std::ws >> s.y >> std::ws;
+    for(int i = 0; i < s.buffer_size; ++i)
+      is >> s.v[i] >> std::ws;
+    return is;
+  }
+#endif
+
+  friend bool operator==(const shuffle_output& x, const shuffle_output& y)
+  { return x._rng == y._rng && x.y == y.y && std::equal(x.v, x.v+k, y.v); }
+  friend bool operator!=(const shuffle_output& x, const shuffle_output& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const shuffle_output& rhs) const
+  { return _rng == rhs._rng && y == rhs.y && std::equal(v, v+k, rhs.v); }
+  bool operator!=(const shuffle_output& rhs) const
+  { return !(*this == rhs); }
+#endif
+private:
+  void init()
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_integer);
+#endif
+    result_type range = (max)()-(min)();
+    assert(range > 0);      // otherwise there would be little choice
+    if(static_cast<unsigned long>(k * range) < 
+       static_cast<unsigned long>(range))  // not a sufficient condition
+      // likely overflow with bucket number computation
+      assert(!"overflow will occur");
+
+    // we cannot use std::generate, because it uses pass-by-value for _rng
+    for(result_type * p = v; p != v+k; ++p)
+      *p = _rng();
+    y = _rng();
+  }
+
+  base_type _rng;
+  result_type v[k];
+  result_type y;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UniformRandomNumberGenerator, int k, 
+#ifndef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
+  typename UniformRandomNumberGenerator::result_type 
+#else
+  uint32_t
+#endif
+  val>
+const bool shuffle_output<UniformRandomNumberGenerator, k, val>::has_fixed_range;
+
+template<class UniformRandomNumberGenerator, int k, 
+#ifndef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
+  typename UniformRandomNumberGenerator::result_type 
+#else
+  uint32_t
+#endif
+  val>
+const int shuffle_output<UniformRandomNumberGenerator, k, val>::buffer_size;
+#endif
+
+} // namespace random
+
+// validation by experiment from Harry Erwin's generator.h (private e-mail)
+/**
+ * According to Harry Erwin (private e-mail), the specialization
+ * @c kreutzer1986 was suggested in:
+ *
+ * @blockquote
+ * "System Simulation: Programming Styles and Languages (International
+ * Computer Science Series)", Wolfgang Kreutzer, Addison-Wesley, December 1986.
+ * @endblockquote
+ */
+typedef random::shuffle_output<
+    random::linear_congruential<uint32_t, 1366, 150889, 714025, 0>,
+  97, 139726> kreutzer1986;
+
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_SHUFFLE_OUTPUT_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/subtract_with_carry.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/subtract_with_carry.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/subtract_with_carry.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/subtract_with_carry.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,465 @@
+/* boost random/subtract_with_carry.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: subtract_with_carry.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2002-03-02  created
+ */
+
+#ifndef BOOST_RANDOM_SUBTRACT_WITH_CARRY_HPP
+#define BOOST_RANDOM_SUBTRACT_WITH_CARRY_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <iostream>
+#include <algorithm>     // std::equal
+#include <stdexcept>
+#include <boost/config/no_tr1/cmath.hpp>         // std::pow
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/seed.hpp>
+#include <boost/random/linear_congruential.hpp>
+
+
+namespace boost {
+namespace random {
+
+#if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
+#  define BOOST_RANDOM_EXTRACT_SWC_01
+#endif
+
+#if defined(__APPLE_CC__) && defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 3)
+#  define BOOST_RANDOM_EXTRACT_SWC_01
+#endif
+
+# ifdef BOOST_RANDOM_EXTRACT_SWC_01
+namespace detail
+{
+  template <class IStream, class SubtractWithCarry, class RealType>
+  void extract_subtract_with_carry_01(
+      IStream& is
+      , SubtractWithCarry& f
+      , RealType& carry
+      , RealType* x
+      , RealType modulus)
+  {
+    RealType value;
+    for(unsigned int j = 0; j < f.long_lag; ++j) {
+      is >> value >> std::ws;
+      x[j] = value / modulus;
+    }
+    is >> value >> std::ws;
+    carry = value / modulus;
+  }
+}
+# endif
+
+/**
+ * Instantiations of @c subtract_with_carry model a
+ * \pseudo_random_number_generator.  The algorithm is
+ * described in
+ *
+ *  @blockquote
+ *  "A New Class of Random Number Generators", George
+ *  Marsaglia and Arif Zaman, Annals of Applied Probability,
+ *  Volume 1, Number 3 (1991), 462-480.
+ *  @endblockquote
+ */
+template<class IntType, IntType m, unsigned int s, unsigned int r,
+  IntType val>
+class subtract_with_carry
+{
+public:
+  typedef IntType result_type;
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = true);
+  BOOST_STATIC_CONSTANT(result_type, min_value = 0);
+  BOOST_STATIC_CONSTANT(result_type, max_value = m-1);
+  BOOST_STATIC_CONSTANT(result_type, modulus = m);
+  BOOST_STATIC_CONSTANT(unsigned int, long_lag = r);
+  BOOST_STATIC_CONSTANT(unsigned int, short_lag = s);
+
+  subtract_with_carry() {
+    // 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<result_type>::is_signed);
+    BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_integer);
+#endif
+    seed();
+  }
+  BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(subtract_with_carry, uint32_t, value)
+  { seed(value); }
+  BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(subtract_with_carry, Generator, gen)
+  { seed(gen); }
+  template<class It> subtract_with_carry(It& first, It last) { seed(first,last); }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  void seed() { seed(19780503u); }
+  BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(subtract_with_carry, uint32_t, value)
+  {
+    random::linear_congruential<int32_t, 40014, 0, 2147483563, 0> intgen(value);
+    seed(intgen);
+  }
+
+  // For GCC, moving this function out-of-line prevents inlining, which may
+  // reduce overall object code size.  However, MSVC does not grok
+  // out-of-line template member functions.
+  BOOST_RANDOM_DETAIL_GENERATOR_SEED(subtract_with_carry, Generator, 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] = gen() % modulus;
+    carry = (x[long_lag-1] == 0);
+    k = 0;
+  }
+
+  template<class It>
+  void seed(It& first, It last)
+  {
+    unsigned int j;
+    for(j = 0; j < long_lag && first != last; ++j, ++first)
+      x[j] = *first % modulus;
+    if(first == last && j < long_lag)
+      throw std::invalid_argument("subtract_with_carry::seed");
+    carry = (x[long_lag-1] == 0);
+    k = 0;
+   }
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return min_value; }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return max_value; }
+
+  result_type operator()()
+  {
+    int short_index = k - short_lag;
+    if(short_index < 0)
+      short_index += long_lag;
+    IntType delta;
+    if (x[short_index] >= x[k] + carry) {
+      // x(n) >= 0
+      delta =  x[short_index] - (x[k] + carry);
+      carry = 0;
+    } else {
+      // x(n) < 0
+      delta = modulus - x[k] - carry + x[short_index];
+      carry = 1;
+    }
+    x[k] = delta;
+    ++k;
+    if(k >= long_lag)
+      k = 0;
+    return delta;
+  }
+
+public:
+  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 subtract_with_carry& f)
+  {
+    for(unsigned int j = 0; j < f.long_lag; ++j)
+      os << f.compute(j) << " ";
+    os << f.carry << " ";
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, subtract_with_carry& f)
+  {
+    for(unsigned int j = 0; j < f.long_lag; ++j)
+      is >> f.x[j] >> std::ws;
+    is >> f.carry >> std::ws;
+    f.k = 0;
+    return is;
+  }
+#endif
+
+  friend bool operator==(const subtract_with_carry& x, const subtract_with_carry& y)
+  {
+    for(unsigned int j = 0; j < r; ++j)
+      if(x.compute(j) != y.compute(j))
+        return false;
+    return true;
+  }
+
+  friend bool operator!=(const subtract_with_carry& x, const subtract_with_carry& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const subtract_with_carry& rhs) const
+  {
+    for(unsigned int j = 0; j < r; ++j)
+      if(compute(j) != rhs.compute(j))
+        return false;
+    return true;
+  }
+
+  bool operator!=(const subtract_with_carry& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  /// \cond hide_private_members
+  // returns x(i-r+index), where index is in 0..r-1
+  IntType compute(unsigned int index) const
+  {
+    return x[(k+index) % long_lag];
+  }
+  /// \endcond
+
+  // state representation; next output (state) is x(i)
+  //   x[0]  ... x[k] x[k+1] ... x[long_lag-1]     represents
+  //  x(i-k) ... x(i) x(i+1) ... x(i-k+long_lag-1)
+  // speed: base: 20-25 nsec
+  // ranlux_4: 230 nsec, ranlux_7: 430 nsec, ranlux_14: 810 nsec
+  // This state representation makes operator== and save/restore more
+  // difficult, because we've already computed "too much" and thus
+  // have to undo some steps to get at x(i-r) etc.
+
+  // state representation: next output (state) is x(i)
+  //   x[0]  ... x[k] x[k+1]          ... x[long_lag-1]     represents
+  //  x(i-k) ... x(i) x(i-long_lag+1) ... x(i-k-1)
+  // speed: base 28 nsec
+  // ranlux_4: 370 nsec, ranlux_7: 688 nsec, ranlux_14: 1343 nsec
+  IntType x[long_lag];
+  unsigned int k;
+  int carry;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const bool subtract_with_carry<IntType, m, s, r, val>::has_fixed_range;
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const IntType subtract_with_carry<IntType, m, s, r, val>::min_value;
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const IntType subtract_with_carry<IntType, m, s, r, val>::max_value;
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const IntType subtract_with_carry<IntType, m, s, r, val>::modulus;
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const unsigned int subtract_with_carry<IntType, m, s, r, val>::long_lag;
+template<class IntType, IntType m, unsigned int s, unsigned int r, IntType val>
+const unsigned int subtract_with_carry<IntType, m, s, r, val>::short_lag;
+#endif
+
+
+// use a floating-point representation to produce values in [0..1)
+/** @copydoc boost::random::subtract_with_carry */
+template<class RealType, int w, unsigned int s, unsigned int r, int val=0>
+class subtract_with_carry_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 = r);
+  BOOST_STATIC_CONSTANT(unsigned int, short_lag = s);
+
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+  BOOST_STATIC_ASSERT(!std::numeric_limits<result_type>::is_integer);
+#endif
+
+  subtract_with_carry_01() { init_modulus(); seed(); }
+  explicit subtract_with_carry_01(uint32_t value)
+  { init_modulus(); seed(value);   }
+  template<class It> subtract_with_carry_01(It& first, It last)
+  { init_modulus(); seed(first,last); }
+
+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 hide_private_members
+
+public:
+  // compiler-generated copy ctor and assignment operator are fine
+
+  void seed(uint32_t value = 19780503u)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::fmod;
+#endif
+    random::linear_congruential<int32_t, 40014, 0, 2147483563, 0> gen(value);
+    unsigned long array[(w+31)/32 * long_lag];
+    for(unsigned int j = 0; j < sizeof(array)/sizeof(unsigned long); ++j)
+      array[j] = gen();
+    unsigned long * start = array;
+    seed(start, array + sizeof(array)/sizeof(unsigned long));
+  }
+
+  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%32) 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 i = 0; i < w/32 && first != last; ++i, ++first)
+        x[j] += *first / pow(two32,i+1);
+      if(first != last && mask != 0) {
+        x[j] += fmod((*first & mask) / _modulus, RealType(1));
+        ++first;
+      }
+    }
+    if(first == last && j < long_lag)
+      throw std::invalid_argument("subtract_with_carry_01::seed");
+    carry = (x[long_lag-1] ? 0 : 1 / _modulus);
+    k = 0;
+  }
+
+  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()()
+  {
+    int short_index = k - short_lag;
+    if(short_index < 0)
+      short_index += long_lag;
+    RealType delta = x[short_index] - x[k] - carry;
+    if(delta < 0) {
+      delta += RealType(1);
+      carry = RealType(1)/_modulus;
+    } else {
+      carry = 0;
+    }
+    x[k] = delta;
+    ++k;
+    if(k >= long_lag)
+      k = 0;
+    return delta;
+  }
+
+  static bool validation(result_type x)
+  { return x == val/pow(RealType(2), word_size); }
+  
+#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 subtract_with_carry_01& f)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    // allow for Koenig lookup
+    using std::pow;
+#endif
+    std::ios_base::fmtflags oldflags = os.flags(os.dec | os.fixed | os.left); 
+    for(unsigned int j = 0; j < f.long_lag; ++j)
+      os << (f.compute(j) * f._modulus) << " ";
+    os << (f.carry * 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, subtract_with_carry_01& f)
+  {
+# ifdef BOOST_RANDOM_EXTRACT_SWC_01
+      detail::extract_subtract_with_carry_01(is, f, f.carry, f.x, f._modulus);
+# else
+    // MSVC (up to 7.1) and Borland (up to 5.64) don't handle the template type
+    // parameter "RealType" available from the class template scope, so use
+    // the member typedef
+    typename subtract_with_carry_01::result_type value;
+    for(unsigned int j = 0; j < long_lag; ++j) {
+      is >> value >> std::ws;
+      f.x[j] = value / f._modulus;
+    }
+    is >> value >> std::ws;
+    f.carry = value / f._modulus;
+# endif 
+    f.k = 0;
+    return is;
+  }
+#endif
+
+  friend bool operator==(const subtract_with_carry_01& x,
+                         const subtract_with_carry_01& y)
+  {
+    for(unsigned int j = 0; j < r; ++j)
+      if(x.compute(j) != y.compute(j))
+        return false;
+    return true;
+  }
+
+  friend bool operator!=(const subtract_with_carry_01& x,
+                         const subtract_with_carry_01& y)
+  { return !(x == y); }
+#else
+  // Use a member function; Streamable concept not supported.
+  bool operator==(const subtract_with_carry_01& rhs) const
+  { 
+    for(unsigned int j = 0; j < r; ++j)
+      if(compute(j) != rhs.compute(j))
+        return false;
+    return true;
+  }
+
+  bool operator!=(const subtract_with_carry_01& rhs) const
+  { return !(*this == rhs); }
+#endif
+
+private:
+  /// \cond hide_private_members
+  RealType compute(unsigned int index) const;
+  /// \endcond
+  unsigned int k;
+  RealType carry;
+  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 s, unsigned int r, int val>
+const bool subtract_with_carry_01<RealType, w, s, r, val>::has_fixed_range;
+template<class RealType, int w, unsigned int s, unsigned int r, int val>
+const int subtract_with_carry_01<RealType, w, s, r, val>::word_size;
+template<class RealType, int w, unsigned int s, unsigned int r, int val>
+const unsigned int subtract_with_carry_01<RealType, w, s, r, val>::long_lag;
+template<class RealType, int w, unsigned int s, unsigned int r, int val>
+const unsigned int subtract_with_carry_01<RealType, w, s, r, val>::short_lag;
+#endif
+
+/// \cond hide_private_members
+template<class RealType, int w, unsigned int s, unsigned int r, int val>
+RealType subtract_with_carry_01<RealType, w, s, r, val>::compute(unsigned int index) const
+{
+  return x[(k+index) % long_lag];
+}
+/// \endcond
+
+} // namespace random
+} // namespace boost
+
+#endif // BOOST_RANDOM_SUBTRACT_WITH_CARRY_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/triangle_distribution.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/triangle_distribution.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/triangle_distribution.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/triangle_distribution.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,118 @@
+/* boost random/triangle_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: triangle_distribution.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_TRIANGLE_DISTRIBUTION_HPP
+#define BOOST_RANDOM_TRIANGLE_DISTRIBUTION_HPP
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <cassert>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/uniform_01.hpp>
+
+namespace boost {
+
+/**
+ * Instantiations of @c triangle_distribution model a \random_distribution.
+ * A @c triangle_distribution has three parameters, @c a, @c b, and @c c,
+ * which are the smallest, the most probable and the largest values of
+ * the distribution respectively.
+ */
+template<class RealType = double>
+class triangle_distribution
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+
+  /**
+   * Constructs a @c triangle_distribution with the parameters
+   * @c a, @c b, and @c c.
+   *
+   * Preconditions: a <= b <= c.
+   */
+  explicit triangle_distribution(result_type a_arg = result_type(0),
+                                 result_type b_arg = result_type(0.5),
+                                 result_type c_arg = result_type(1))
+    : _a(a_arg), _b(b_arg), _c(c_arg)
+  {
+    assert(_a <= _b && _b <= _c);
+    init();
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /** Returns the @c a parameter of the distribution */
+  result_type a() const { return _a; }
+  /** Returns the @c b parameter of the distribution */
+  result_type b() const { return _b; }
+  /** Returns the @c c parameter of the distribution */
+  result_type c() const { return _c; }
+
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::sqrt;
+#endif
+    result_type u = eng();
+    if( u <= q1 )
+      return _a + p1*sqrt(u);
+    else
+      return _c - d3*sqrt(d2*u-d1);
+  }
+
+#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 triangle_distribution& td)
+  {
+    os << td._a << " " << td._b << " " << td._c;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, triangle_distribution& td)
+  {
+    is >> std::ws >> td._a >> std::ws >> td._b >> std::ws >> td._c;
+    td.init();
+    return is;
+  }
+#endif
+
+private:
+  /// \cond hide_private_members
+  void init()
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::sqrt;
+#endif
+    d1 = _b - _a;
+    d2 = _c - _a;
+    d3 = sqrt(_c - _b);
+    q1 = d1 / d2;
+    p1 = sqrt(d1 * d2);
+  }
+  /// \endcond
+
+  result_type _a, _b, _c;
+  result_type d1, d2, d3, q1, p1;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_TRIANGLE_DISTRIBUTION_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_01.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_01.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_01.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_01.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,273 @@
+/* boost random/uniform_01.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_01.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_UNIFORM_01_HPP
+#define BOOST_RANDOM_UNIFORM_01_HPP
+
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/pass_through_engine.hpp>
+
+#include <boost/random/detail/disable_warnings.hpp>
+
+namespace boost {
+
+#ifdef BOOST_RANDOM_DOXYGEN
+
+/**
+ * The distribution function uniform_01 models a \random_distribution.
+ * On each invocation, it returns a random floating-point value
+ * uniformly distributed in the range [0..1).
+ *
+ * The template parameter RealType shall denote a float-like value type
+ * with support for binary operators +, -, and /.
+ *
+ * Note: The current implementation is buggy, because it may not fill
+ * all of the mantissa with random bits. I'm unsure how to fill a
+ * (to-be-invented) @c boost::bigfloat class with random bits efficiently.
+ * It's probably time for a traits class.
+ */
+template<class RealType = double>
+class uniform_01
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
+  void reset();
+
+  template<class Engine>
+  result_type operator()(Engine& 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 new_uniform_01&)
+  {
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&)
+  {
+    return is;
+  }
+#endif
+};
+
+#else
+
+namespace detail {
+
+template<class RealType>
+class new_uniform_01
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+  // compiler-generated copy ctor and copy assignment are fine
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng) {
+    for (;;) {
+      typedef typename Engine::result_type base_result;
+      result_type factor = result_type(1) /
+              (result_type((eng.max)()-(eng.min)()) +
+               result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0));
+      result_type result = result_type(eng() - (eng.min)()) * factor;
+      if (result < result_type(1))
+        return result;
+    }
+  }
+
+#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 new_uniform_01&)
+  {
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&)
+  {
+    return is;
+  }
+#endif
+};
+
+template<class UniformRandomNumberGenerator, class RealType>
+class backward_compatible_uniform_01
+{
+  typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits;
+  typedef boost::random::detail::pass_through_engine<UniformRandomNumberGenerator> internal_engine_type;
+public:
+  typedef UniformRandomNumberGenerator base_type;
+  typedef RealType result_type;
+
+  BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+
+#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 backward_compatible_uniform_01(typename traits::rvalue_type rng)
+    : _rng(rng),
+      _factor(result_type(1) /
+              (result_type((_rng.max)()-(_rng.min)()) +
+               result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0)))
+  {
+  }
+  // compiler-generated copy ctor and copy assignment are fine
+
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
+  typename traits::value_type& base() { return _rng.base(); }
+  const typename traits::value_type& base() const { return _rng.base(); }
+  void reset() { }
+
+  result_type operator()() {
+    for (;;) {
+      result_type result = result_type(_rng() - (_rng.min)()) * _factor;
+      if (result < result_type(1))
+        return result;
+    }
+  }
+
+#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const backward_compatible_uniform_01& u)
+  {
+    os << u._rng;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, backward_compatible_uniform_01& u)
+  {
+    is >> u._rng;
+    return is;
+  }
+#endif
+
+private:
+  typedef typename internal_engine_type::result_type base_result;
+  internal_engine_type _rng;
+  result_type _factor;
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+//  A definition is required even for integral static constants
+template<class UniformRandomNumberGenerator, class RealType>
+const bool backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType>::has_fixed_range;
+#endif
+
+template<class UniformRandomNumberGenerator>
+struct select_uniform_01
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType> type;
+  };
+};
+
+template<>
+struct select_uniform_01<float>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<float> type;
+  };
+};
+
+template<>
+struct select_uniform_01<double>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<double> type;
+  };
+};
+
+template<>
+struct select_uniform_01<long double>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<long double> type;
+  };
+};
+
+}
+
+// Because it is so commonly used: uniform distribution on the real [0..1)
+// range.  This allows for specializations to avoid a costly int -> float
+// conversion plus float multiplication
+template<class UniformRandomNumberGenerator = double, class RealType = double>
+class uniform_01
+  : public detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type
+{
+  typedef typename detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type impl_type;
+  typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits;
+public:
+
+  uniform_01() {}
+
+  explicit uniform_01(typename traits::rvalue_type rng)
+    : impl_type(rng)
+  {
+  }
+
+#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_01& u)
+  {
+    os << static_cast<const impl_type&>(u);
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, uniform_01& u)
+  {
+    is >> static_cast<impl_type&>(u);
+    return is;
+  }
+#endif
+};
+
+#endif
+
+} // namespace boost
+
+#include <boost/random/detail/enable_warnings.hpp>
+
+#endif // BOOST_RANDOM_UNIFORM_01_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_int.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_int.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_int.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_int.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,300 @@
+/* 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 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * 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 <cassert>
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/signed_unsigned_tools.hpp>
+#include <boost/type_traits/make_unsigned.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.
+ */
+template<class IntType = int>
+class uniform_int
+{
+public:
+  typedef IntType input_type;
+  typedef IntType result_type;
+
+  /// \cond hide_private_members
+  typedef typename make_unsigned<result_type>::type range_type;
+  /// \endcond
+
+  /**
+   * Constructs a uniform_int object. @c min and @c max are
+   * the parameters of the distribution.
+   *
+   * Requires: min <= max
+   */
+  explicit uniform_int(IntType min_arg = 0, IntType max_arg = 9)
+    : _min(min_arg), _max(max_arg)
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
+    BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
+#endif
+    assert(min_arg <= max_arg);
+    init();
+  }
+
+  /**
+   * Returns: The "min" parameter of the distribution
+   */
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
+  /**
+   * Returns: The "max" parameter of the distribution
+   */
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
+  void reset() { }
+  
+  // can't have member function templates out-of-line due to MSVC bugs
+  template<class Engine>
+  result_type operator()(Engine& eng)
+  {
+      return generate(eng, _min, _max, _range);
+  }
+
+  template<class Engine>
+  result_type operator()(Engine& eng, result_type n)
+  {
+      assert(n > 0);
+
+      if (n == 1)
+      {
+        return 0;
+      }
+
+      return generate(eng, 0, n - 1, n - 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 uniform_int& 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& ud)
+  {
+    is >> std::ws >> ud._min >> std::ws >> ud._max;
+    ud.init();
+    return is;
+  }
+#endif
+
+private:
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+// disable division by zero warning, since we can't
+// actually divide by zero.
+#pragma warning(disable:4723)
+#endif
+
+  /// \cond hide_private_members
+  template<class Engine>
+  static result_type generate(Engine& eng, result_type min_value, result_type /*max_value*/, range_type range)
+  {
+    typedef typename Engine::result_type base_result;
+    // ranges are always unsigned
+    typedef typename make_unsigned<base_result>::type base_unsigned;
+    const base_result bmin = (eng.min)();
+    const base_unsigned brange =
+      random::detail::subtract<base_result>()((eng.max)(), (eng.min)());
+
+    if(range == 0) {
+      return min_value;    
+    } else if(brange == range) {
+      // this will probably never happen in real life
+      // basically nothing to do; just take care we don't overflow / underflow
+      base_unsigned v = random::detail::subtract<base_result>()(eng(), bmin);
+      return random::detail::add<base_unsigned, result_type>()(v, min_value);
+    } else if(brange < range) {
+      // use rejection method to handle things like 0..3 --> 0..4
+      for(;;) {
+        // concatenate several invocations of the base RNG
+        // take extra care to avoid overflows
+
+        //  limit == floor((range+1)/(brange+1))
+        //  Therefore limit*(brange+1) <= range+1
+        range_type limit;
+        if(range == (std::numeric_limits<range_type>::max)()) {
+          limit = range/(range_type(brange)+1);
+          if(range % (range_type(brange)+1) == range_type(brange))
+            ++limit;
+        } else {
+          limit = (range+1)/(range_type(brange)+1);
+        }
+
+        // We consider "result" as expressed to base (brange+1):
+        // For every power of (brange+1), we determine a random factor
+        range_type result = range_type(0);
+        range_type mult = range_type(1);
+
+        // loop invariants:
+        //  result < mult
+        //  mult <= range
+        while(mult <= limit) {
+          // Postcondition: result <= range, thus no overflow
+          //
+          // limit*(brange+1)<=range+1                   def. of limit       (1)
+          // eng()-bmin<=brange                          eng() post.         (2)
+          // and mult<=limit.                            loop condition      (3)
+          // Therefore mult*(eng()-bmin+1)<=range+1      by (1),(2),(3)      (4)
+          // Therefore mult*(eng()-bmin)+mult<=range+1   rearranging (4)     (5)
+          // result<mult                                 loop invariant      (6)
+          // Therefore result+mult*(eng()-bmin)<range+1  by (5), (6)         (7)
+          //
+          // Postcondition: result < mult*(brange+1)
+          //
+          // result<mult                                 loop invariant      (1)
+          // eng()-bmin<=brange                          eng() post.         (2)
+          // Therefore result+mult*(eng()-bmin) <
+          //           mult+mult*(eng()-bmin)            by (1)              (3)
+          // Therefore result+(eng()-bmin)*mult <
+          //           mult+mult*brange                  by (2), (3)         (4)
+          // Therefore result+(eng()-bmin)*mult <
+          //           mult*(brange+1)                   by (4)
+          result += static_cast<range_type>(random::detail::subtract<base_result>()(eng(), bmin) * mult);
+
+          // equivalent to (mult * (brange+1)) == range+1, but avoids overflow.
+          if(mult * range_type(brange) == range - mult + 1) {
+              // The destination range is an integer power of
+              // the generator's range.
+              return(result);
+          }
+
+          // Postcondition: mult <= range
+          // 
+          // limit*(brange+1)<=range+1                   def. of limit       (1)
+          // mult<=limit                                 loop condition      (2)
+          // Therefore mult*(brange+1)<=range+1          by (1), (2)         (3)
+          // mult*(brange+1)!=range+1                    preceding if        (4)
+          // Therefore mult*(brange+1)<range+1           by (3), (4)         (5)
+          // 
+          // Postcondition: result < mult
+          //
+          // See the second postcondition on the change to result. 
+          mult *= range_type(brange)+range_type(1);
+        }
+        // loop postcondition: range/mult < brange+1
+        //
+        // mult > limit                                  loop condition      (1)
+        // Suppose range/mult >= brange+1                Assumption          (2)
+        // range >= mult*(brange+1)                      by (2)              (3)
+        // range+1 > mult*(brange+1)                     by (3)              (4)
+        // range+1 > (limit+1)*(brange+1)                by (1), (4)         (5)
+        // (range+1)/(brange+1) > limit+1                by (5)              (6)
+        // limit < floor((range+1)/(brange+1))           by (6)              (7)
+        // limit==floor((range+1)/(brange+1))            def. of limit       (8)
+        // not (2)                                       reductio            (9)
+        //
+        // loop postcondition: (range/mult)*mult+(mult-1) >= range
+        //
+        // (range/mult)*mult + range%mult == range       identity            (1)
+        // range%mult < mult                             def. of %           (2)
+        // (range/mult)*mult+mult > range                by (1), (2)         (3)
+        // (range/mult)*mult+(mult-1) >= range           by (3)              (4)
+        //
+        // Note that the maximum value of result at this point is (mult-1),
+        // so after this final step, we generate numbers that can be
+        // at least as large as range.  We have to really careful to avoid
+        // overflow in this final addition and in the rejection.  Anything
+        // that overflows is larger than range and can thus be rejected.
+
+        // range/mult < brange+1  -> no endless loop
+        range_type result_increment = uniform_int<range_type>(0, range/mult)(eng);
+        if((std::numeric_limits<range_type>::max)() / mult < result_increment) {
+          // The multiplcation would overflow.  Reject immediately.
+          continue;
+        }
+        result_increment *= mult;
+        // unsigned integers are guaranteed to wrap on overflow.
+        result += result_increment;
+        if(result < result_increment) {
+          // The addition overflowed.  Reject.
+          continue;
+        }
+        if(result > range) {
+          // Too big.  Reject.
+          continue;
+        }
+        return random::detail::add<range_type, result_type>()(result, min_value);
+      }
+    } else {                   // brange > range
+      base_unsigned bucket_size;
+      // it's safe to add 1 to range, as long as we cast it first,
+      // because we know that it is less than brange.  However,
+      // we do need to be careful not to cause overflow by adding 1
+      // to brange.
+      if(brange == (std::numeric_limits<base_unsigned>::max)()) {
+        bucket_size = brange / (static_cast<base_unsigned>(range)+1);
+        if(brange % (static_cast<base_unsigned>(range)+1) == static_cast<base_unsigned>(range)) {
+          ++bucket_size;
+        }
+      } else {
+        bucket_size = (brange+1) / (static_cast<base_unsigned>(range)+1);
+      }
+      for(;;) {
+        base_unsigned result =
+          random::detail::subtract<base_result>()(eng(), bmin);
+        result /= bucket_size;
+        // result and range are non-negative, and result is possibly larger
+        // than range, so the cast is safe
+        if(result <= static_cast<base_unsigned>(range))
+          return random::detail::add<base_unsigned, result_type>()(result, min_value);
+      }
+    }
+  }
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+  void init()
+  {
+    _range = random::detail::subtract<result_type>()(_max, _min);
+  }
+
+  /// \endcond
+
+  // The result_type may be signed or unsigned, but the _range is always
+  // unsigned.
+  result_type _min, _max;
+  range_type _range;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_UNIFORM_INT_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_on_sphere.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_on_sphere.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_on_sphere.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_on_sphere.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,101 @@
+/* boost random/uniform_on_sphere.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_on_sphere.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_UNIFORM_ON_SPHERE_HPP
+#define BOOST_RANDOM_UNIFORM_ON_SPHERE_HPP
+
+#include <vector>
+#include <algorithm>     // std::transform
+#include <functional>    // std::bind2nd, std::divides
+#include <boost/random/detail/config.hpp>
+#include <boost/random/normal_distribution.hpp>
+
+namespace boost {
+
+/**
+ * Instantiations of class template uniform_on_sphere model a
+ * \random_distribution. Such a distribution produces random
+ * numbers uniformly distributed on the unit sphere of arbitrary
+ * dimension @c dim. The @c Cont template parameter must be a STL-like
+ * container type with begin and end operations returning non-const
+ * ForwardIterators of type @c Cont::iterator. Each invocation of the
+ * @c UniformRandomNumberGenerator shall result in a floating-point
+ * value in the range [0,1). 
+ */
+template<class RealType = double, class Cont = std::vector<RealType> >
+class uniform_on_sphere
+{
+public:
+  typedef RealType input_type;
+  typedef Cont result_type;
+
+  /**
+   * Constructs a @c uniform_on_sphere distribution.
+   * @c dim is the dimension of the sphere.
+   */
+  explicit uniform_on_sphere(int dim = 2) : _container(dim), _dim(dim) { }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  void reset() { _normal.reset(); }
+
+  template<class Engine>
+  const result_type & operator()(Engine& eng)
+  {
+    RealType sqsum = 0;
+    for(typename Cont::iterator it = _container.begin();
+        it != _container.end();
+        ++it) {
+      RealType val = _normal(eng);
+      *it = val;
+      sqsum += val * val;
+    }
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::sqrt;
+#endif
+    // for all i: result[i] /= sqrt(sqsum)
+    std::transform(_container.begin(), _container.end(), _container.begin(),
+                   std::bind2nd(std::divides<RealType>(), sqrt(sqsum)));
+    return _container;
+  }
+
+#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_on_sphere& sd)
+  {
+    os << sd._dim;
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, uniform_on_sphere& sd)
+  {
+    is >> std::ws >> sd._dim;
+    sd._container.resize(sd._dim);
+    return is;
+  }
+#endif
+
+private:
+  normal_distribution<RealType> _normal;
+  result_type _container;
+  int _dim;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_UNIFORM_ON_SPHERE_HPP

Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_real.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_real.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_real.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_real.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,108 @@
+/* boost random/uniform_real.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_real.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-04-08  added min<max assertion (N. Becker)
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_UNIFORM_REAL_HPP
+#define BOOST_RANDOM_UNIFORM_REAL_HPP
+
+#include <cassert>
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+
+namespace boost {
+
+/**
+ * The distribution function uniform_real models a random distribution.
+ * On each invocation, it returns a random floating-point value uniformly
+ * distributed in the range [min..max). The value is computed using
+ * std::numeric_limits<RealType>::digits random binary digits, i.e.
+ * the mantissa of the floating-point value is completely filled with
+ * random bits.
+ *
+ * Note: The current implementation is buggy, because it may not fill
+ * all of the mantissa with random bits.
+ */
+template<class RealType = double>
+class uniform_real
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+
+  /**
+   * Constructs a uniform_real object. @c min and @c max are the
+   * parameters of the distribution.
+   *
+   * Requires: min <= max
+   */
+  explicit uniform_real(RealType min_arg = RealType(0),
+                        RealType max_arg = RealType(1))
+    : _min(min_arg), _max(max_arg)
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+    BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
+#endif
+    assert(min_arg <= max_arg);
+  }
+
+  // compiler-generated copy ctor and assignment operator are fine
+
+  /**
+   * Returns: The "min" parameter of the distribution
+   */
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
+  /**
+   * Returns: The "max" parameter of the distribution
+   */
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng) {
+    result_type numerator = static_cast<result_type>(eng() - eng.min BOOST_PREVENT_MACRO_SUBSTITUTION());
+    result_type divisor = static_cast<result_type>(eng.max BOOST_PREVENT_MACRO_SUBSTITUTION() - eng.min BOOST_PREVENT_MACRO_SUBSTITUTION());
+    assert(divisor > 0);
+    assert(numerator >= 0 && numerator <= divisor);
+    return numerator / divisor * (_max - _min) + _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_real& 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_real& ud)
+  {
+    is >> std::ws >> ud._min >> std::ws >> ud._max;
+    return is;
+  }
+#endif
+
+private:
+  RealType _min, _max;
+};
+
+} // namespace boost
+
+#endif // BOOST_RANDOM_UNIFORM_REAL_HPP