|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58555 - trunk/libs/random
From: steven_at_[hidden]
Date: 2009-12-28 23:53:36
Author: steven_watanabe
Date: 2009-12-28 23:53:36 EST (Mon, 28 Dec 2009)
New Revision: 58555
URL: http://svn.boost.org/trac/boost/changeset/58555
Log:
Attempt to fix ranlux failures
Text files modified:
trunk/libs/random/instantiate.cpp | 51 +++++++++++++++++++++++++++++++++------
1 files changed, 43 insertions(+), 8 deletions(-)
Modified: trunk/libs/random/instantiate.cpp
==============================================================================
--- trunk/libs/random/instantiate.cpp (original)
+++ trunk/libs/random/instantiate.cpp 2009-12-28 23:53:36 EST (Mon, 28 Dec 2009)
@@ -152,9 +152,7 @@
}
template<class URNG, class ResultType>
-void test_seed(const URNG &, const ResultType & v) {
- typename URNG::result_type value = static_cast<typename URNG::result_type>(v);
-
+void test_seed(const URNG &, const ResultType & value) {
URNG urng(value);
// integral types
@@ -186,16 +184,53 @@
urng2.seed();
BOOST_CHECK(urng == urng2);
}
- test_seed(urng, 0);
- test_seed(urng, 127);
- test_seed(urng, 539157235);
- test_seed(urng, ~0u);
+ test_seed(urng, static_cast<ResultType>(0));
+ test_seed(urng, static_cast<ResultType>(127));
+ test_seed(urng, static_cast<ResultType>(539157235));
+ test_seed(urng, static_cast<ResultType>(~0u));
+}
+
+// ranlux uses int32_t for seeding instead of result_type
+template<class ResultType>
+void instantiate_seed(const boost::ranlux3 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux3, boost::int32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux4 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux4, boost::int32_t>(urng, ResultType());
}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux3_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux3_01, boost::int32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux4_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux4_01, boost::int32_t>(urng, ResultType());
+}
+#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_3 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3, boost::int32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_4 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3, boost::int32_t>(urng, ResultType());
+}
+#endif
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_3_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3_01, boost::int32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_4_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_4_01, boost::int32_t>(urng, ResultType());
+}
+
template<class URNG, class ResultType>
void instantiate_urng(const std::string & s, const URNG & u, const ResultType & r)
{
- std::cout << "Basic tests for " << s;
+ std::cout << "Basic tests for " << s << std::endl;
URNG urng;
instantiate_seed(u, r); // seed() member function
int a[URNG::has_fixed_range ? 5 : 10]; // compile-time constant
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk