Commit 026ae646 by Paolo Carlini Committed by Paolo Carlini

random: Minor formatting and cosmetic tweaks.

2014-07-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/ext/random: Minor formatting and cosmetic tweaks.
	(uniform_on_sphere_distribution<>::operator==
	(const uniform_on_sphere_distribution&,
	const uniform_on_sphere_distribution&)): Compare the _M_nds.
	(uniform_on_sphere_distribution<>::reset): Reset _M_nd.
	(operator!=(const uniform_on_sphere_distribution&,
	const uniform_on_sphere_distribution&)): Adjust.
	* include/ext/random.tcc: Minor cosmetc tweaks.

From-SVN: r212674
parent 9dc30a5f
2014-07-16 Paolo Carlini <paolo.carlini@oracle.com>
* include/ext/random: Minor formatting and cosmetic tweaks.
(uniform_on_sphere_distribution<>::operator==
(const uniform_on_sphere_distribution&,
const uniform_on_sphere_distribution&)): Compare the _M_nds.
(uniform_on_sphere_distribution<>::reset): Reset _M_nd.
(operator!=(const uniform_on_sphere_distribution&,
const uniform_on_sphere_distribution&)): Adjust.
* include/ext/random.tcc: Minor cosmetc tweaks.
2014-07-15 Jonathan Wakely <jwakely@redhat.com> 2014-07-15 Jonathan Wakely <jwakely@redhat.com>
* python/libstdcxx/v6/printers.py (TemplateTypePrinter): Add type * python/libstdcxx/v6/printers.py (TemplateTypePrinter): Add type
......
...@@ -598,7 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -598,7 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool inline bool
operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1, operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1,
const __gnu_cxx::beta_distribution<_RealType>& __d2) const __gnu_cxx::beta_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); } { return !(__d1 == __d2); }
/** /**
...@@ -2575,7 +2575,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2575,7 +2575,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool inline bool
operator!=(const __gnu_cxx::triangular_distribution<_RealType>& __d1, operator!=(const __gnu_cxx::triangular_distribution<_RealType>& __d1,
const __gnu_cxx::triangular_distribution<_RealType>& __d2) const __gnu_cxx::triangular_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); } { return !(__d1 == __d2); }
/** /**
...@@ -2810,7 +2810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2810,7 +2810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool inline bool
operator!=(const __gnu_cxx::von_mises_distribution<_RealType>& __d1, operator!=(const __gnu_cxx::von_mises_distribution<_RealType>& __d1,
const __gnu_cxx::von_mises_distribution<_RealType>& __d2) const __gnu_cxx::von_mises_distribution<_RealType>& __d2)
{ return !(__d1 == __d2); } { return !(__d1 == __d2); }
/** /**
...@@ -3328,12 +3328,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3328,12 +3328,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
explicit explicit
uniform_on_sphere_distribution() uniform_on_sphere_distribution()
: _M_param(), _M_n(_RealType(0), _RealType(1)) : _M_param(), _M_nd()
{ } { }
explicit explicit
uniform_on_sphere_distribution(const param_type& __p) uniform_on_sphere_distribution(const param_type& __p)
: _M_param(__p), _M_n(_RealType(0), _RealType(1)) : _M_param(__p), _M_nd()
{ } { }
/** /**
...@@ -3341,7 +3341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3341,7 +3341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
void void
reset() reset()
{ } { _M_nd.reset(); }
/** /**
* @brief Returns the parameter set of the distribution. * @brief Returns the parameter set of the distribution.
...@@ -3425,14 +3425,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3425,14 +3425,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool friend bool
operator==(const uniform_on_sphere_distribution& __d1, operator==(const uniform_on_sphere_distribution& __d1,
const uniform_on_sphere_distribution& __d2) const uniform_on_sphere_distribution& __d2)
{ return true; } { return __d1._M_nd == __d2._M_nd; }
/** /**
* @brief Inserts a %uniform_on_sphere_distribution random number distribution * @brief Inserts a %uniform_on_sphere_distribution random number
* @p __x into the output stream @p __os. * distribution @p __x into the output stream @p __os.
* *
* @param __os An output stream. * @param __os An output stream.
* @param __x A %uniform_on_sphere_distribution random number distribution. * @param __x A %uniform_on_sphere_distribution random number
* distribution.
* *
* @returns The output stream with the state of @p __x inserted or in * @returns The output stream with the state of @p __x inserted or in
* an error state. * an error state.
...@@ -3446,11 +3447,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3446,11 +3447,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__x); __x);
/** /**
* @brief Extracts a %uniform_on_sphere_distribution random number distribution * @brief Extracts a %uniform_on_sphere_distribution random number
* distribution
* @p __x from the input stream @p __is. * @p __x from the input stream @p __is.
* *
* @param __is An input stream. * @param __is An input stream.
* @param __x A %uniform_on_sphere_distribution random number generator engine. * @param __x A %uniform_on_sphere_distribution random number
* generator engine.
* *
* @returns The input stream with @p __x extracted or in an error state. * @returns The input stream with @p __x extracted or in an error state.
*/ */
...@@ -3470,7 +3473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3470,7 +3473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const param_type& __p); const param_type& __p);
param_type _M_param; param_type _M_param;
std::normal_distribution<_RealType> _M_n; std::normal_distribution<_RealType> _M_nd;
}; };
/** /**
...@@ -3482,7 +3485,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3482,7 +3485,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RealType>& __d1, _RealType>& __d1,
const __gnu_cxx::uniform_on_sphere_distribution<_Dimen, const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __d2) _RealType>& __d2)
{ return false; } { return !(__d1 == __d2); }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx } // namespace __gnu_cxx
......
...@@ -1551,7 +1551,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1551,7 +1551,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RealType __sum = _RealType(0); _RealType __sum = _RealType(0);
std::generate(__ret.begin(), __ret.end(), std::generate(__ret.begin(), __ret.end(),
[&__urng, &__sum, this](){ _RealType __t = _M_n(__urng); [&__urng, &__sum, this](){ _RealType __t = _M_nd(__urng);
__sum += __t * __t; __sum += __t * __t;
return __t; }); return __t; });
auto __norm = std::sqrt(__sum); auto __norm = std::sqrt(__sum);
...@@ -1583,8 +1583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1583,8 +1583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const __gnu_cxx::uniform_on_sphere_distribution<_Dimen, const __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __x) _RealType>& __x)
{ {
// The distribution has no state, nothing to save. return __os << __x._M_nd;
return __os << __x._M_n;
} }
template<std::size_t _Dimen, typename _RealType, typename _CharT, template<std::size_t _Dimen, typename _RealType, typename _CharT,
...@@ -1594,8 +1593,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1594,8 +1593,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__gnu_cxx::uniform_on_sphere_distribution<_Dimen, __gnu_cxx::uniform_on_sphere_distribution<_Dimen,
_RealType>& __x) _RealType>& __x)
{ {
// The distribution has no state, nothing to restore. return __is >> __x._M_nd;
return __is >> __x._M_n;
} }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
......
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