Commit 95fe602e by Paolo Carlini Committed by Paolo Carlini

random: Remove, empty.

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.

From-SVN: r145493
parent 01e935c1
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> 2009-04-02 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
......
// random number generation -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -64,7 +64,8 @@ namespace std ...@@ -64,7 +64,8 @@ namespace std
namespace __detail namespace __detail
{ {
template<typename _UIntType, size_t __w, 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 struct _Shift
{ static const _UIntType __value = 0; }; { static const _UIntType __value = 0; };
...@@ -74,9 +75,13 @@ namespace std ...@@ -74,9 +75,13 @@ namespace std
// XXX need constexpr // XXX need constexpr
template<typename _UIntType, size_t __w, 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 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> template<typename _UIntType, size_t __w>
struct _ShiftMin1<_UIntType, __w, true> struct _ShiftMin1<_UIntType, __w, true>
......
// random number generation (out of line) -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -32,14 +32,11 @@ ...@@ -32,14 +32,11 @@
* You should not attempt to use it directly. * You should not attempt to use it directly.
*/ */
#include <iostream>
#include <vector>
#include <numeric> #include <numeric>
#include <algorithm> #include <algorithm>
namespace std namespace std
{ {
/* /*
* (Further) implementation-space details. * (Further) implementation-space details.
*/ */
...@@ -181,9 +178,7 @@ namespace std ...@@ -181,9 +178,7 @@ namespace std
const typename __ios_base::fmtflags __flags = __os.flags(); const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill(); const _CharT __fill = __os.fill();
__os.flags(__ios_base::dec __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
| __ios_base::fixed
| __ios_base::left);
__os.fill(__os.widen(' ')); __os.fill(__os.widen(' '));
__os << __lcr._M_x; __os << __lcr._M_x;
...@@ -347,9 +342,7 @@ namespace std ...@@ -347,9 +342,7 @@ namespace std
const typename __ios_base::fmtflags __flags = __os.flags(); const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill(); const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' '); const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
| __ios_base::fixed
| __ios_base::left);
__os.fill(__space); __os.fill(__space);
for (size_t __i = 0; __i < __n - 1; ++__i) for (size_t __i = 0; __i < __n - 1; ++__i)
...@@ -487,9 +480,7 @@ namespace std ...@@ -487,9 +480,7 @@ namespace std
const typename __ios_base::fmtflags __flags = __os.flags(); const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill(); const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' '); const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
| __ios_base::fixed
| __ios_base::left);
__os.fill(__space); __os.fill(__space);
for (size_t __i = 0; __i < __r; ++__i) for (size_t __i = 0; __i < __r; ++__i)
...@@ -550,9 +541,7 @@ namespace std ...@@ -550,9 +541,7 @@ namespace std
const typename __ios_base::fmtflags __flags = __os.flags(); const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill(); const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' '); const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
| __ios_base::fixed
| __ios_base::left);
__os.fill(__space); __os.fill(__space);
__os << __x.base() << __space << __x._M_n; __os << __x.base() << __space << __x._M_n;
...@@ -653,9 +642,7 @@ namespace std ...@@ -653,9 +642,7 @@ namespace std
const typename __ios_base::fmtflags __flags = __os.flags(); const typename __ios_base::fmtflags __flags = __os.flags();
const _CharT __fill = __os.fill(); const _CharT __fill = __os.fill();
const _CharT __space = __os.widen(' '); const _CharT __space = __os.widen(' ');
__os.flags(__ios_base::dec __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
| __ios_base::fixed
| __ios_base::left);
__os.fill(__space); __os.fill(__space);
__os << __x.base(); __os << __x.base();
...@@ -2331,9 +2318,7 @@ namespace std ...@@ -2331,9 +2318,7 @@ namespace std
piecewise_constant_distribution<_RealType>::param_type:: piecewise_constant_distribution<_RealType>::param_type::
param_type() param_type()
: _M_int(), _M_den(), _M_cp() : _M_int(), _M_den(), _M_cp()
{ { _M_initialize(); }
_M_initialize();
}
template<typename _RealType> template<typename _RealType>
template<typename _InputIteratorB, typename _InputIteratorW> template<typename _InputIteratorB, typename _InputIteratorW>
...@@ -2532,9 +2517,7 @@ namespace std ...@@ -2532,9 +2517,7 @@ namespace std
piecewise_linear_distribution<_RealType>::param_type:: piecewise_linear_distribution<_RealType>::param_type::
param_type() param_type()
: _M_int(), _M_den(), _M_cp(), _M_m() : _M_int(), _M_den(), _M_cp(), _M_m()
{ { _M_initialize(); }
_M_initialize();
}
template<typename _RealType> template<typename _RealType>
template<typename _InputIteratorB, typename _InputIteratorW> template<typename _InputIteratorB, typename _InputIteratorW>
...@@ -2790,5 +2773,4 @@ namespace std ...@@ -2790,5 +2773,4 @@ namespace std
} }
return __sum / __tmp; return __sum / __tmp;
} }
} }
// <random> -*- C++ -*- // <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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -40,10 +40,6 @@ ...@@ -40,10 +40,6 @@
# include <c++0x_warning.h> # include <c++0x_warning.h>
#else #else
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
#endif
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
......
// random number generation -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -37,10 +37,6 @@ ...@@ -37,10 +37,6 @@
#pragma GCC system_header #pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
...@@ -54,14 +50,10 @@ ...@@ -54,14 +50,10 @@
#include <tr1/type_traits> #include <tr1/type_traits>
#include <tr1/cmath> #include <tr1/cmath>
#if defined(_GLIBCXX_INCLUDE_AS_TR1) #include <tr1/random.h>
# include <tr1/random.h>
#else #ifndef _GLIBCXX_EXPORT_TEMPLATE
# define _GLIBCXX_INCLUDE_AS_TR1 # include <tr1/random.tcc>
# define _GLIBCXX_TR1 tr1::
# include <tr1/random.h>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif #endif
#endif // _GLIBCXX_TR1_RANDOM #endif // _GLIBCXX_TR1_RANDOM
// random number generation -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -38,28 +38,10 @@ ...@@ -38,28 +38,10 @@
#pragma GCC system_header #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 std
{ {
namespace tr1 namespace tr1
{ {
// [5.1] Random number generation // [5.1] Random number generation
/** /**
...@@ -2427,10 +2409,7 @@ namespace tr1 ...@@ -2427,10 +2409,7 @@ namespace tr1
/* @} */ // group tr1_random_distributions_continuous /* @} */ // group tr1_random_distributions_continuous
/* @} */ // group tr1_random_distributions /* @} */ // group tr1_random_distributions
/* @} */ // group tr1_random /* @} */ // group tr1_random
} }
} }
#include <tr1/random.tcc>
#endif // _GLIBCXX_TR1_RANDOM_H #endif // _GLIBCXX_TR1_RANDOM_H
// random number generation (out of line) -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -36,7 +36,6 @@ namespace std ...@@ -36,7 +36,6 @@ namespace std
{ {
namespace tr1 namespace tr1
{ {
/* /*
* (Further) implementation-space details. * (Further) implementation-space details.
*/ */
...@@ -324,7 +323,7 @@ namespace tr1 ...@@ -324,7 +323,7 @@ namespace tr1
if (__value == 0) if (__value == 0)
__value = 19780503; __value = 19780503;
std::_GLIBCXX_TR1 linear_congruential<unsigned long, 40014, 0, 2147483563> std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>
__lcg(__value); __lcg(__value);
for (int __i = 0; __i < long_lag; ++__i) for (int __i = 0; __i < long_lag; ++__i)
...@@ -443,7 +442,7 @@ namespace tr1 ...@@ -443,7 +442,7 @@ namespace tr1
{ {
for (int __j = 0; __j < __n; ++__j) for (int __j = 0; __j < __n; ++__j)
#if _GLIBCXX_USE_C99_MATH_TR1 #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 #else
_M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32); _M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32);
#endif #endif
...@@ -459,7 +458,7 @@ namespace tr1 ...@@ -459,7 +458,7 @@ namespace tr1
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 512. Seeding subtract_with_carry_01 from a single unsigned long. // 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); __lcg(__value);
this->seed(__lcg); this->seed(__lcg);
...@@ -905,13 +904,13 @@ namespace tr1 ...@@ -905,13 +904,13 @@ namespace tr1
{ {
const _RealType __m = std::floor(_M_mean); const _RealType __m = std::floor(_M_mean);
_M_lm_thr = std::log(_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); _M_sm = std::sqrt(__m);
const _RealType __pi_4 = 0.7853981633974483096156608458198757L; const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m
/ __pi_4)); / __pi_4));
_M_d = std::_GLIBCXX_TR1 round(std::max(_RealType(6), _M_d = std::tr1::round(std::max(_RealType(6),
std::min(__m, __dx))); std::min(__m, __dx)));
const _RealType __cx = 2 * __m + _M_d; const _RealType __cx = 2 * __m + _M_d;
_M_scx = std::sqrt(__cx / 2); _M_scx = std::sqrt(__cx / 2);
...@@ -1008,7 +1007,7 @@ namespace tr1 ...@@ -1008,7 +1007,7 @@ namespace tr1
} }
__reject = (__w - __e - __x * _M_lm_thr __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; __reject |= __x + __m >= __thr;
...@@ -1099,11 +1098,11 @@ namespace tr1 ...@@ -1099,11 +1098,11 @@ namespace tr1
const _RealType __d1x = const _RealType __d1x =
std::sqrt(__np * __1p * std::log(32 * __np std::sqrt(__np * __1p * std::log(32 * __np
/ (81 * __pi_4 * __1p))); / (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 = const _RealType __d2x =
std::sqrt(__np * __1p * std::log(32 * _M_t * __1p std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
/ (__pi_4 * __pa))); / (__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) // sqrt(pi / 2)
const _RealType __spi_2 = 1.2533141373155002512078826424055226L; const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
...@@ -1119,8 +1118,8 @@ namespace tr1 ...@@ -1119,8 +1118,8 @@ namespace tr1
const _RealType __s2s = _M_s2 * _M_s2; const _RealType __s2s = _M_s2 * _M_s2;
_M_s = (_M_a123 + 2 * __s2s / _M_d2 _M_s = (_M_a123 + 2 * __s2s / _M_d2
* std::exp(-_M_d2 * _M_d2 / (2 * __s2s))); * std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
_M_lf = (std::_GLIBCXX_TR1 lgamma(__np + 1) _M_lf = (std::tr1::lgamma(__np + 1)
+ std::_GLIBCXX_TR1 lgamma(_M_t - __np + 1)); + std::tr1::lgamma(_M_t - __np + 1));
_M_lp1p = std::log(__pa / __1p); _M_lp1p = std::log(__pa / __1p);
_M_q = -std::log(1 - (__p12 - __pa) / __1p); _M_q = -std::log(1 - (__p12 - __pa) / __1p);
...@@ -1248,8 +1247,8 @@ namespace tr1 ...@@ -1248,8 +1247,8 @@ namespace tr1
if (!__reject) if (!__reject)
{ {
const _RealType __lfx = const _RealType __lfx =
std::_GLIBCXX_TR1 lgamma(__np + __x + 1) std::tr1::lgamma(__np + __x + 1)
+ std::_GLIBCXX_TR1 lgamma(_M_t - (__np + __x) + 1); + std::tr1::lgamma(_M_t - (__np + __x) + 1);
__reject = __v > _M_lf - __lfx + __x * _M_lp1p; __reject = __v > _M_lf - __lfx + __x * _M_lp1p;
} }
...@@ -1578,6 +1577,5 @@ namespace tr1 ...@@ -1578,6 +1577,5 @@ namespace tr1
__os.precision(__precision); __os.precision(__precision);
return __os; return __os;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment