|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53800 - trunk/libs/random
From: steven_at_[hidden]
Date: 2009-06-11 18:34:50
Author: steven_watanabe
Date: 2009-06-11 18:34:50 EDT (Thu, 11 Jun 2009)
New Revision: 53800
URL: http://svn.boost.org/trac/boost/changeset/53800
Log:
Minor documentation updates
Text files modified:
trunk/libs/random/random-generators.html | 109 ++++++++++++++++++---------------------
1 files changed, 50 insertions(+), 59 deletions(-)
Modified: trunk/libs/random/random-generators.html
==============================================================================
--- trunk/libs/random/random-generators.html (original)
+++ trunk/libs/random/random-generators.html 2009-06-11 18:34:50 EDT (Thu, 11 Jun 2009)
@@ -35,8 +35,8 @@
<li><a href="#mersenne_twister">Class template
<code>random::mersenne_twister</code></a></li>
- <li><a href="#lagged_fibonacci">Class template
- <code>random::lagged_fibonacci</code></a></li>
+ <li><a href="#lagged_fibonacci_01">Class template
+ <code>random::lagged_fibonacci_01</code></a></li>
<li>Performance</li>
</ul>
@@ -351,18 +351,18 @@
typedef random::mersenne_twister< /* ... */ > mt19937;
namespace random {
- template<class FloatType, unsigned int p, unsigned int q>
- class lagged_fibonacci;
+ template<class FloatType, int w, unsigned int p, unsigned int q>
+ class lagged_fibonacci_01;
}
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci607;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci1279;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci2281;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci3217;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci4423;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci9689;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci19937;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci23209;
- typedef random::lagged_fibonacci< /* ... */ > lagged_fibonacci44497;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci607;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci1279;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci2281;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci3217;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci4423;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci9689;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci19937;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci23209;
+ typedef random::lagged_fibonacci_01< /* ... */ > lagged_fibonacci44497;
} // namespace boost
</pre>
@@ -773,7 +773,7 @@
#include <<a href=
"../../boost/random/inversive_congruential.hpp">boost/random/inversive_congruential.hpp</a>>
-template<class IntType, IntType a, IntType b, IntType p>
+template<class IntType, IntType a, IntType b, IntType p, IntType val>
class random::inversive_congruential
{
public:
@@ -789,7 +789,7 @@
IntType operator()();
};
-typedef random::inversive_congruential<int32_t, 9102, 2147483647-36884165, 2147483647> hellekalek1995;
+typedef random::inversive_congruential<int32_t, 9102, 2147483647-36884165, 2147483647, 0> hellekalek1995;
</pre>
<h3>Description</h3>
@@ -812,7 +812,8 @@
<p>The template parameter <code>IntType</code> shall denote a signed
integral type large enough to hold p; a, b, and p are the parameters of the
- generators.</p>
+ generators. The template parameter val is the validation value checked by
+ validation.</p>
<p><em>Note:</em> The implementation currently uses the Euclidian Algorithm
to compute the multiplicative inverse. Therefore, the inversive generators
@@ -849,21 +850,19 @@
#include <<a href=
"../../boost/random/mersenne_twister.hpp">boost/random/mersenne_twister.hpp</a>>
-template<class DataType, int w, int n, int m, int r, DataType a, int u,
-int s, DataType b, int t, DataType c, int l, IntType val>
+template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
+ int s, UIntType b, int t, UIntType c, int l, UIntType val>
class random::mersenne_twister
{
public:
- typedef DataType result_type;
- static const bool has_fixed_range = true;
- static const result_type min_value;
- static const result_type max_value;
+ typedef UIntType result_type;
+ static const bool has_fixed_range = false;
mersenne_twister();
- explicit mersenne_twister(DataType value);
+ explicit mersenne_twister(UIntType value);
template<class Generator> explicit mersenne_twister(Generator & gen);
// compiler-generated copy ctor and assignment operator are fine
void seed();
- void seed(DataType value);
+ void seed(UIntType value);
template<class Generator> void seed(Generator & gen);
result_type operator()();
bool validation(result_type) const;
@@ -918,13 +917,9 @@
<p><strong>Effects:</strong> Constructs a <code>mersenne_twister</code> and
calls <code>seed(gen)</code>.</p>
- <p><em>Note:</em> When using direct-initialization syntax with an lvalue
- (e.g. in the variable definition <code>Gen gen2(gen);</code>), this
- templated constructor will be preferred over the compiler-generated copy
- constructor. For variable definitions which should copy the state of
- another <code>mersenne_twister</code>, use e.g. <code>Gen gen2 =
- gen;</code>, which is copy-initialization syntax and guaranteed to invoke
- the copy constructor.</p>
+ <p><em>Note:</em> The copy constructor will always be preferred over the
+ templated constructor. mersenne_twister takes special steps to guarantee
+ this.</p>
<h3>Seeding</h3>
<pre>
@@ -953,39 +948,35 @@
<p><strong>Complexity:</strong> Exactly <code>n</code> invocations of
<code>gen</code>.</p>
- <p><em>Note:</em> When invoking <code>seed</code> with an lvalue, overload
- resolution chooses the function template unless the type of the argument
- exactly matches <code>result_type</code>. For other integer types, you
- should convert the argument to <code>result_type</code> explicitly.</p>
-
<h3><a name="mt11213b" id="mt11213b"></a><a name="mt19937" id=
"mt19937">Specializations</a></h3>
<p>The specializations <code>mt11213b</code> and <code>mt19937</code> are
from the paper cited above.</p>
- <h2><a name="lagged_fibonacci" id="lagged_fibonacci">Class template
- <code>random::lagged_fibonacci</code></a></h2>
+ <h2><a name="lagged_fibonacci_01" id="lagged_fibonacci_01">Class template
+ <code>random::lagged_fibonacci_01</code></a></h2>
<h3>Synopsis</h3>
<pre>
#include <<a href=
"../../boost/random/lagged_fibonacci.hpp">boost/random/lagged_fibonacci.hpp</a>>
-template<class FloatType, unsigned int p, unsigned int q>
-class lagged_fibonacci
+template<class FloatType, int w, unsigned int p, unsigned int q>
+class lagged_fibonacci_01
{
public:
typedef FloatType result_type;
static const bool has_fixed_range = false;
+ static const int word_size = w;
static const unsigned int long_lag = p;
static const unsigned int short_lag = q;
result_type min() const { return 0.0; }
result_type max() const { return 1.0; }
- lagged_fibonacci();
- explicit lagged_fibonacci(uint32_t value);
+ lagged_fibonacci_01();
+ explicit lagged_fibonacci_01(uint32_t value);
template<class Generator>
- explicit lagged_fibonacci(Generator & gen);
+ explicit lagged_fibonacci_01(Generator & gen);
// compiler-generated copy ctor and assignment operator are fine
void seed(uint32_t value = 331u);
template<class Generator> void seed(Generator & gen);
@@ -993,15 +984,15 @@
bool validation(result_type x) const;
};
-typedef random::lagged_fibonacci<double, 607, 273> lagged_fibonacci607;
-typedef random::lagged_fibonacci<double, 1279, 418> lagged_fibonacci1279;
-typedef random::lagged_fibonacci<double, 2281, 1252> lagged_fibonacci2281;
-typedef random::lagged_fibonacci<double, 3217, 576> lagged_fibonacci3217;
-typedef random::lagged_fibonacci<double, 4423, 2098> lagged_fibonacci4423;
-typedef random::lagged_fibonacci<double, 9689, 5502> lagged_fibonacci9689;
-typedef random::lagged_fibonacci<double, 19937, 9842> lagged_fibonacci19937;
-typedef random::lagged_fibonacci<double, 23209, 13470> lagged_fibonacci23209;
-typedef random::lagged_fibonacci<double, 44497, 21034> lagged_fibonacci44497;
+typedef random::lagged_fibonacci_01<double, 48, 607, 273> lagged_fibonacci607;
+typedef random::lagged_fibonacci_01<double, 48, 1279, 418> lagged_fibonacci1279;
+typedef random::lagged_fibonacci_01<double, 48, 2281, 1252> lagged_fibonacci2281;
+typedef random::lagged_fibonacci_01<double, 48, 3217, 576> lagged_fibonacci3217;
+typedef random::lagged_fibonacci_01<double, 48, 4423, 2098> lagged_fibonacci4423;
+typedef random::lagged_fibonacci_01<double, 48, 9689, 5502> lagged_fibonacci9689;
+typedef random::lagged_fibonacci_01<double, 48, 19937, 9842> lagged_fibonacci19937;
+typedef random::lagged_fibonacci_01<double, 48, 23209, 13470> lagged_fibonacci23209;
+typedef random::lagged_fibonacci_01<double, 48, 44497, 21034> lagged_fibonacci44497;
</pre>
<h3>Description</h3>
@@ -1029,22 +1020,22 @@
<h3>Constructors</h3>
<pre>
-lagged_fibonacci()
+lagged_fibonacci_01()
</pre>
- <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci</code>
+ <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci_01</code>
generator and calls <code>seed()</code>.</p>
<pre>
-explicit lagged_fibonacci(uint32_t value)
+explicit lagged_fibonacci_01(uint32_t value)
</pre>
- <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci</code>
+ <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci_01</code>
generator and calls <code>seed(value)</code>.</p>
<pre>
-template<class Generator> explicit lagged_fibonacci(Generator & gen)
+template<class Generator> explicit lagged_fibonacci_01(Generator & gen)
</pre>
- <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci</code>
+ <p><strong>Effects:</strong> Constructs a <code>lagged_fibonacci_01</code>
generator and calls <code>seed(gen)</code>.</p>
<h3>Seeding</h3>
@@ -1065,7 +1056,7 @@
</pre>
<p><strong>Effects:</strong> Sets the state of this
- <code>lagged_fibonacci</code> to the values returned by <code>p</code>
+ <code>lagged_fibonacci_01</code> to the values returned by <code>p</code>
invocations of <code>uniform_01<gen, FloatType></code>.<br>
<strong>Complexity:</strong> Exactly <code>p</code> invocations of
<code>gen</code>.</p>
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