+2009-04-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/random: Remove, empty.
+ * include/tr1_impl/random.tcc: Likewise.
+
+ * include/std/random: Minor clean-ups, formatting fixes, adjust
+ copyright years.
+ * include/bits/random.tcc: Likewise.
+ * include/bits/random.h: Likewise.
+ * include/tr1/random: Likewise.
+ * include/tr1/random.tcc: Likewise.
+ * include/tr1/random.h: Likewise.
+
2009-04-02 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
// random number generation -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
namespace __detail
{
template<typename _UIntType, size_t __w,
- bool = __w < static_cast<size_t>(std::numeric_limits<_UIntType>::digits)>
+ bool = __w < static_cast<size_t>
+ (std::numeric_limits<_UIntType>::digits)>
struct _Shift
{ static const _UIntType __value = 0; };
// XXX need constexpr
template<typename _UIntType, size_t __w,
- bool = __w <static_cast<size_t>(std::numeric_limits<_UIntType>::digits)>
+ bool = __w <static_cast<size_t>
+ (std::numeric_limits<_UIntType>::digits)>
struct _ShiftMin1
- { static const _UIntType __value = __gnu_cxx::__numeric_traits<_UIntType>::max; };
+ {
+ static const _UIntType __value =
+ __gnu_cxx::__numeric_traits<_UIntType>::max;
+ };
template<typename _UIntType, size_t __w>
struct _ShiftMin1<_UIntType, __w, true>
// random number generation (out of line) -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
* You should not attempt to use it directly.
*/
-#include <iostream>
-#include <vector>
#include <numeric>
#include <algorithm>
namespace std
{
-
/*
* (Further) implementation-space details.
*/
seed(_UIntType __x0)
{
if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
- && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
+ && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
else
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
{
_UIntType __x0 = __g();
if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
- && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
+ && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
else
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
- __os.flags(__ios_base::dec
- | __ios_base::fixed
- | __ios_base::left);
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__os.widen(' '));
__os << __lcr._M_x;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
- __os.flags(__ios_base::dec
- | __ios_base::fixed
- | __ios_base::left);
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (size_t __i = 0; __i < __n - 1; ++__i)
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
- __os.flags(__ios_base::dec
- | __ios_base::fixed
- | __ios_base::left);
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
for (size_t __i = 0; __i < __r; ++__i)
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
- __os.flags(__ios_base::dec
- | __ios_base::fixed
- | __ios_base::left);
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
__os << __x.base() << __space << __x._M_n;
const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' ');
- __os.flags(__ios_base::dec
- | __ios_base::fixed
- | __ios_base::left);
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
__os << __x.base();
piecewise_constant_distribution<_RealType>::param_type::
param_type()
: _M_int(), _M_den(), _M_cp()
- {
- _M_initialize();
- }
+ { _M_initialize(); }
template<typename _RealType>
template<typename _InputIteratorB, typename _InputIteratorW>
piecewise_linear_distribution<_RealType>::param_type::
param_type()
: _M_int(), _M_den(), _M_cp(), _M_m()
- {
- _M_initialize();
- }
+ { _M_initialize(); }
template<typename _RealType>
template<typename _InputIteratorB, typename _InputIteratorW>
}
return __sum / __tmp;
}
-
}
// <random> -*- C++ -*-
-// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
# include <c++0x_warning.h>
#else
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# error C++0x header cannot be included from TR1 header
-#endif
-
#include <cmath>
#include <cstdio>
#include <cstdlib>
// random number generation -*- C++ -*-
-// Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tr1/type_traits>
#include <tr1/cmath>
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-# include <tr1/random.h>
-#else
-# define _GLIBCXX_INCLUDE_AS_TR1
-# define _GLIBCXX_TR1 tr1::
-# include <tr1/random.h>
-# undef _GLIBCXX_TR1
-# undef _GLIBCXX_INCLUDE_AS_TR1
+#include <tr1/random.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <tr1/random.tcc>
#endif
#endif // _GLIBCXX_TR1_RANDOM
// random number generation -*- C++ -*-
-// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
#pragma GCC system_header
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-# error TR1 header cannot be included from C++0x header
-#endif
-
-#include <cmath>
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include <iosfwd>
-#include <limits>
-#include <ext/type_traits.h>
-#include <ext/numeric_traits.h>
-#include <bits/concept_check.h>
-#include <debug/debug.h>
-#include <tr1/type_traits>
-#include <tr1/cmath>
-
namespace std
{
namespace tr1
{
-
// [5.1] Random number generation
/**
/* @} */ // group tr1_random_distributions_continuous
/* @} */ // group tr1_random_distributions
/* @} */ // group tr1_random
-
}
}
-#include <tr1/random.tcc>
-
#endif // _GLIBCXX_TR1_RANDOM_H
// random number generation (out of line) -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
{
namespace tr1
{
-
/*
* (Further) implementation-space details.
*/
if (__value == 0)
__value = 19780503;
- std::_GLIBCXX_TR1 linear_congruential<unsigned long, 40014, 0, 2147483563>
+ std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>
__lcg(__value);
for (int __i = 0; __i < long_lag; ++__i)
{
for (int __j = 0; __j < __n; ++__j)
#if _GLIBCXX_USE_C99_MATH_TR1
- _M_npows[__j] = std::_GLIBCXX_TR1 ldexp(_RealType(1), -__w + __j * 32);
+ _M_npows[__j] = std::tr1::ldexp(_RealType(1), -__w + __j * 32);
#else
_M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32);
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 512. Seeding subtract_with_carry_01 from a single unsigned long.
- std::_GLIBCXX_TR1 linear_congruential<unsigned long, 40014, 0, 2147483563>
+ std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>
__lcg(__value);
this->seed(__lcg);
{
const _RealType __m = std::floor(_M_mean);
_M_lm_thr = std::log(_M_mean);
- _M_lfm = std::_GLIBCXX_TR1 lgamma(__m + 1);
+ _M_lfm = std::tr1::lgamma(__m + 1);
_M_sm = std::sqrt(__m);
const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m
/ __pi_4));
- _M_d = std::_GLIBCXX_TR1 round(std::max(_RealType(6),
- std::min(__m, __dx)));
+ _M_d = std::tr1::round(std::max(_RealType(6),
+ std::min(__m, __dx)));
const _RealType __cx = 2 * __m + _M_d;
_M_scx = std::sqrt(__cx / 2);
_M_1cx = 1 / __cx;
}
__reject = (__w - __e - __x * _M_lm_thr
- > _M_lfm - std::_GLIBCXX_TR1 lgamma(__x + __m + 1));
+ > _M_lfm - std::tr1::lgamma(__x + __m + 1));
__reject |= __x + __m >= __thr;
const _RealType __d1x =
std::sqrt(__np * __1p * std::log(32 * __np
/ (81 * __pi_4 * __1p)));
- _M_d1 = std::_GLIBCXX_TR1 round(std::max(_RealType(1), __d1x));
+ _M_d1 = std::tr1::round(std::max(_RealType(1), __d1x));
const _RealType __d2x =
std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
/ (__pi_4 * __pa)));
- _M_d2 = std::_GLIBCXX_TR1 round(std::max(_RealType(1), __d2x));
+ _M_d2 = std::tr1::round(std::max(_RealType(1), __d2x));
// sqrt(pi / 2)
const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
const _RealType __s2s = _M_s2 * _M_s2;
_M_s = (_M_a123 + 2 * __s2s / _M_d2
* std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
- _M_lf = (std::_GLIBCXX_TR1 lgamma(__np + 1)
- + std::_GLIBCXX_TR1 lgamma(_M_t - __np + 1));
+ _M_lf = (std::tr1::lgamma(__np + 1)
+ + std::tr1::lgamma(_M_t - __np + 1));
_M_lp1p = std::log(__pa / __1p);
_M_q = -std::log(1 - (__p12 - __pa) / __1p);
if (!__reject)
{
const _RealType __lfx =
- std::_GLIBCXX_TR1 lgamma(__np + __x + 1)
- + std::_GLIBCXX_TR1 lgamma(_M_t - (__np + __x) + 1);
+ std::tr1::lgamma(__np + __x + 1)
+ + std::tr1::lgamma(_M_t - (__np + __x) + 1);
__reject = __v > _M_lf - __lfx + __x * _M_lp1p;
}
__os.precision(__precision);
return __os;
}
-
}
}