OSDN Git Service

2010-03-16 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Mar 2010 16:14:00 +0000 (16:14 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 00:27:22 +0000 (09:27 +0900)
* include/bits/random.h (operator==(const uniform_int_distribution<>&,
const uniform_int_distribution<>&), operator==(const
uniform_real_distribution<>&, const uniform_real_distribution<>&),
operator==(const lognormal_distribution<>&,
const lognormal_distribution<>&), operator==(const
chi_squared_distribution<>&, const chi_squared_distribution<>&),
operator==(const cauchy_distribution<>&, const cauchy_distribution<>&),
operator==(const fisher_distribution<>&, const fisher_distribution<>&),
operator==(const student_t_distribution<>&,
const student_t_distribution<>&), operator==(const
bernoulli_distribution<>&, const bernoulli_distribution<>&),
operator==(const binomial_distribution<>&, const
binomial_distribution<>&), operator==(const geometric_distribution<>&,
const geometric_distribution<>&), operator==(const
negative_binomial_distribution<>&, const
negative_binomial_distribution<>&), operator==(const
poisson_distribution<>&, const poisson_distribution<>&),
operator==(const exponential_distribution<>&,
const exponential_distribution<>&), operator==(const
gamma_distribution<>&, const gamma_distribution<>&), operator==(const
weibull_distribution<>&, const weibull_distribution<>&),
operator==(const extreme_value_distribution<>&,
const extreme_value_distribution<>&), operator==(const
discrete_distribution<>&, const discrete_distribution<>&),
operator==(const piecewise_constant_distribution<>&,
const piecewise_constant_distribution<>&), operator==(const
piecewise_linear_distribution<>&, const
piecewise_linear_distribution<>&)): Add, likewise for operator!=.
(operator!=(const independent_bits_engine<>&, const
independent_bits_engine<>&), operator!=(const
subtract_with_carry_engine<>&, const subtract_with_carry_engine<>&),
operator!=(const discard_block_engine<>&, const
discard_block_engine<>&), operator!=(const mersenne_twister_engine<>&,
const mersenne_twister_engine<>&), operator!=(const
linear_congruential_engine<>&, const linear_congruential_engine<>&),
operator!=(const shuffle_order_engine<>&, const
shuffle_order_engine<>&): Add.
* include/bits/random.tcc (operator==(const normal_distribution<>&,
const normal_distribution<>&)): Add.
* testsuite/26_numerics/random/uniform_real_distribution/operators/
inequal.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/piecewise_constant_distribution/
operators/inequal.cc: Likewise.
* testsuite/26_numerics/random/piecewise_constant_distribution/
operators/equal.cc: Likewise.
* testsuite/26_numerics/random/chi_squared_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/chi_squared_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/normal_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/normal_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/uniform_int_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/uniform_int_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/poisson_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/poisson_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/bernoulli_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/bernoulli_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/discrete_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/discrete_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/weibull_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/weibull_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/independent_bits_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/subtract_with_carry_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/discard_block_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/cauchy_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/cauchy_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/negative_binomial_distribution/
operators/inequal.cc: Likewise.
* testsuite/26_numerics/random/negative_binomial_distribution/
operators/equal.cc: Likewise.
* testsuite/26_numerics/random/gamma_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/gamma_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/mersenne_twister_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/fisher_f_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/fisher_f_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/exponential_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/exponential_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/binomial_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/binomial_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/lognormal_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/lognormal_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/extreme_value_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/extreme_value_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/piecewise_linear_distribution/
operators/inequal.cc: Likewise.
* testsuite/26_numerics/random/piecewise_linear_distribution/
operators/equal.cc: Likewise.
* testsuite/26_numerics/random/student_t_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/student_t_distribution/operators/
equal.cc: Likewise.
* testsuite/26_numerics/random/linear_congruential_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/shuffle_order_engine/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/geometric_distribution/operators/
inequal.cc: Likewise.
* testsuite/26_numerics/random/geometric_distribution/operators/
equal.cc: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157489 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h

index 24543b0..9c37f37 100644 (file)
@@ -1,3 +1,137 @@
+2010-03-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/bits/random.h (operator==(const uniform_int_distribution<>&,
+       const uniform_int_distribution<>&), operator==(const
+       uniform_real_distribution<>&, const uniform_real_distribution<>&),
+       operator==(const lognormal_distribution<>&,
+       const lognormal_distribution<>&), operator==(const
+       chi_squared_distribution<>&, const chi_squared_distribution<>&),
+       operator==(const cauchy_distribution<>&, const cauchy_distribution<>&),
+       operator==(const fisher_distribution<>&, const fisher_distribution<>&),
+       operator==(const student_t_distribution<>&,
+       const student_t_distribution<>&), operator==(const
+       bernoulli_distribution<>&, const bernoulli_distribution<>&),
+       operator==(const binomial_distribution<>&, const
+       binomial_distribution<>&), operator==(const geometric_distribution<>&,
+       const geometric_distribution<>&), operator==(const
+       negative_binomial_distribution<>&, const
+       negative_binomial_distribution<>&), operator==(const
+       poisson_distribution<>&, const poisson_distribution<>&),
+       operator==(const exponential_distribution<>&,
+       const exponential_distribution<>&), operator==(const
+       gamma_distribution<>&, const gamma_distribution<>&), operator==(const
+       weibull_distribution<>&, const weibull_distribution<>&),
+       operator==(const extreme_value_distribution<>&,
+       const extreme_value_distribution<>&), operator==(const
+       discrete_distribution<>&, const discrete_distribution<>&),
+       operator==(const piecewise_constant_distribution<>&,
+       const piecewise_constant_distribution<>&), operator==(const
+       piecewise_linear_distribution<>&, const
+       piecewise_linear_distribution<>&)): Add, likewise for operator!=.
+       (operator!=(const independent_bits_engine<>&, const
+       independent_bits_engine<>&), operator!=(const
+       subtract_with_carry_engine<>&, const subtract_with_carry_engine<>&),
+       operator!=(const discard_block_engine<>&, const
+       discard_block_engine<>&), operator!=(const mersenne_twister_engine<>&,
+       const mersenne_twister_engine<>&), operator!=(const
+       linear_congruential_engine<>&, const linear_congruential_engine<>&),
+       operator!=(const shuffle_order_engine<>&, const
+       shuffle_order_engine<>&): Add.
+       * include/bits/random.tcc (operator==(const normal_distribution<>&,
+       const normal_distribution<>&)): Add.
+       * testsuite/26_numerics/random/uniform_real_distribution/operators/
+       inequal.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/
+       operators/inequal.cc: Likewise.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/
+       operators/equal.cc: Likewise.
+       * testsuite/26_numerics/random/chi_squared_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/chi_squared_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/normal_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/normal_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/uniform_int_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/uniform_int_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/poisson_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/poisson_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/bernoulli_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/bernoulli_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/discrete_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/discrete_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/weibull_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/weibull_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/independent_bits_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/discard_block_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/cauchy_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/cauchy_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/negative_binomial_distribution/
+       operators/inequal.cc: Likewise.
+       * testsuite/26_numerics/random/negative_binomial_distribution/
+       operators/equal.cc: Likewise.
+       * testsuite/26_numerics/random/gamma_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/gamma_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/mersenne_twister_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/fisher_f_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/fisher_f_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/exponential_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/exponential_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/binomial_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/binomial_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/lognormal_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/lognormal_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/extreme_value_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/extreme_value_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/
+       operators/inequal.cc: Likewise.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/
+       operators/equal.cc: Likewise.
+       * testsuite/26_numerics/random/student_t_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/student_t_distribution/operators/
+       equal.cc: Likewise.
+       * testsuite/26_numerics/random/linear_congruential_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/shuffle_order_engine/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/geometric_distribution/operators/
+       inequal.cc: Likewise.
+       * testsuite/26_numerics/random/geometric_distribution/operators/
+       equal.cc: Likewise.
+
 2010-03-15  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/bits/forward_list.tcc (_Fwd_list_node_base::
index cc950f0..3f1a615 100644 (file)
@@ -1695,6 +1695,20 @@ namespace std
       { return _M_param.b(); }
 
       /**
+       * @brief Returns the inclusive lower bound of the distribution range.
+       */
+      result_type
+      min() const
+      { return this->a(); }
+
+      /**
+       * @brief Returns the inclusive upper bound of the distribution range.
+       */
+      result_type
+      max() const
+      { return this->b(); }
+
+      /**
        * @brief Returns the parameter set of the distribution.
        */
       param_type
@@ -1710,27 +1724,19 @@ namespace std
       { _M_param = __param; }
 
       /**
-       * @brief Returns the inclusive lower bound of the distribution range.
-       */
-      result_type
-      min() const
-      { return this->a(); }
-
-      /**
-       * @brief Returns the inclusive upper bound of the distribution range.
-       */
-      result_type
-      max() const
-      { return this->b(); }
-
-      /**
-       * @brief Generating functions.
+       * Gets a uniformly distributed random number in the range
+       * @f$(min, max)@f$.
        */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
         { return this->operator()(__urng, this->param()); }
 
+      /**
+       * Gets a uniform random number in the range @f$[0, n)@f$.
+       *
+       * This function is aimed at use with std::random_shuffle.
+       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng,
@@ -1870,21 +1876,6 @@ namespace std
       { return _M_param.b(); }
 
       /**
-       * @brief Returns the parameter set of the distribution.
-       */
-      param_type
-      param() const
-      { return _M_param; }
-
-      /**
-       * @brief Sets the parameter set of the distribution.
-       * @param __param The new parameter set of the distribution.
-       */
-      void
-      param(const param_type& __param)
-      { _M_param = __param; }
-
-      /**
        * @brief Returns the inclusive lower bound of the distribution range.
        */
       result_type
@@ -1899,8 +1890,20 @@ namespace std
       { return this->b(); }
 
       /**
-       * @brief Generating functions.
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
        */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2092,9 +2095,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2265,9 +2265,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2459,9 +2456,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2619,9 +2613,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2795,9 +2786,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -2971,9 +2959,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -3144,9 +3129,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
         operator()(_UniformRandomNumberGenerator& __urng)
@@ -3328,7 +3310,7 @@ namespace std
     { return std::numeric_limits<result_type>::max(); }
 
     /**
-     * @brief Generating functions.
+     * @brief Returns the next value in the Bernoullian sequence.
      */
     template<typename _UniformRandomNumberGenerator>
       result_type
@@ -3528,19 +3510,6 @@ namespace std
       { return _M_param.t(); }
 
       /**
-       * @brief Generating functions.
-       */
-      template<typename _UniformRandomNumberGenerator>
-       result_type
-       operator()(_UniformRandomNumberGenerator& __urng)
-       { return this->operator()(__urng, this->param()); }
-
-      template<typename _UniformRandomNumberGenerator>
-       result_type
-       operator()(_UniformRandomNumberGenerator& __urng,
-                  const param_type& __p);
-
-      /**
        * @brief Return true if two binomial distributions have
        *        the same parameters and the sequences that would
        *        be generated are equal.
@@ -3555,6 +3524,16 @@ namespace std
         { return __d1.param() == __d2.param(); }
 #endif
 
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
       /**
        * @brief Inserts a %binomial_distribution random number distribution
        * @p __x into the output stream @p __os.
@@ -3712,9 +3691,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -3884,9 +3860,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
         operator()(_UniformRandomNumberGenerator& __urng);
@@ -4067,9 +4040,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -4249,9 +4219,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -4429,9 +4396,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -4604,9 +4568,6 @@ namespace std
       max() const
       { return std::numeric_limits<result_type>::max(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -4795,9 +4756,6 @@ namespace std
       max() const
       { return this->_M_param._M_prob.size() - 1; }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -5002,9 +4960,6 @@ namespace std
       max() const
       { return this->_M_param._M_int.back(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)
@@ -5213,9 +5168,6 @@ namespace std
       max() const
       { return this->_M_param._M_int.back(); }
 
-      /**
-       * @brief Generating functions.
-       */
       template<typename _UniformRandomNumberGenerator>
        result_type
        operator()(_UniformRandomNumberGenerator& __urng)