|
Boost-Commit : |
From: johnmaddock_at_[hidden]
Date: 2007-07-26 08:50:32
Author: johnmaddock
Date: 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
New Revision: 7545
URL: http://svn.boost.org/trac/boost/changeset/7545
Log:
Added typedef to binomial: there is no longer any name clash with the "binomial_coefficient" function.
Updated distribution docs to bring them into synch with the policy based code. Still a few "TODO" sections at present.
Text files modified:
sandbox/math_toolkit/boost/math/distributions/binomial.hpp | 2 +
sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk | 38 ++++++++++++++----------
sandbox/math_toolkit/libs/math/doc/distributions/NAG_library.qbk | 12 +++----
sandbox/math_toolkit/libs/math/doc/distributions/Pareto.qbk | 7 ++--
sandbox/math_toolkit/libs/math/doc/distributions/Rayleigh.qbk | 8 +++--
sandbox/math_toolkit/libs/math/doc/distributions/bernoulli.qbk | 10 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/beta.qbk | 7 +++-
sandbox/math_toolkit/libs/math/doc/distributions/binomial.qbk | 12 ++++----
sandbox/math_toolkit/libs/math/doc/distributions/binomial_example.qbk | 2
sandbox/math_toolkit/libs/math/doc/distributions/cauchy.qbk | 11 ++++++-
sandbox/math_toolkit/libs/math/doc/distributions/chi_squared.qbk | 10 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/chi_squared_examples.qbk | 15 ++-------
sandbox/math_toolkit/libs/math/doc/distributions/error_handling_example.qbk | 2 +
sandbox/math_toolkit/libs/math/doc/distributions/exponential.qbk | 10 +++++-
sandbox/math_toolkit/libs/math/doc/distributions/extreme_value.qbk | 10 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/f_dist_example.qbk | 15 ++-------
sandbox/math_toolkit/libs/math/doc/distributions/fisher.qbk | 7 ++--
sandbox/math_toolkit/libs/math/doc/distributions/gamma.qbk | 15 +++++++--
sandbox/math_toolkit/libs/math/doc/distributions/lognormal.qbk | 8 +++--
sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial.qbk | 9 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/non_members.qbk | 60 ++++++++++++++++++++--------------------
sandbox/math_toolkit/libs/math/doc/distributions/normal.qbk | 8 +++--
sandbox/math_toolkit/libs/math/doc/distributions/poisson.qbk | 10 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/students_t.qbk | 8 +++--
sandbox/math_toolkit/libs/math/doc/distributions/students_t_examples.qbk | 32 ++++++++++----------
sandbox/math_toolkit/libs/math/doc/distributions/triangular.qbk | 10 ++++--
sandbox/math_toolkit/libs/math/doc/distributions/uniform.qbk | 9 +++--
sandbox/math_toolkit/libs/math/doc/distributions/weibull.qbk | 8 +++--
sandbox/math_toolkit/libs/math/doc/math.qbk | 4 ++
29 files changed, 205 insertions(+), 154 deletions(-)
Modified: sandbox/math_toolkit/boost/math/distributions/binomial.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/binomial.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/binomial.hpp 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -416,6 +416,8 @@
RealType m_p; // success_fraction
}; // template <class RealType, class Policy> class binomial_distribution
+ typedef binomial_distribution<> binomial;
+
template <class RealType, class Policy>
const std::pair<RealType, RealType> range(const binomial_distribution<RealType, Policy>& dist)
{ // Range of permissible values for random variable k.
Modified: sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -20,17 +20,23 @@
All the code in this library is inside namespace boost::math.
In order to use a distribution /my_distribution/ you will need to include
-the header <boost/math/distributions/my_distribution.hpp>.
-For example, to use the Students-t distribution include
-<boost/math/distributions/students_t.hpp>
+either the header <boost/math/distributions/my_distribution.hpp> or
+the "include everything" header: <boost/math/distributions.hpp>.
+
+For example, to use the Students-t distribution include either
+<boost/math/distributions/students_t.hpp> or
+<boost/math/distributions.hpp>
[h4 Distributions are Objects]
Each kind of distribution in this library is a class type.
+TODO: we need to mention and link to policies here.
+
[tip If you are familiar with statistics libraries using functions,
and 'Distributions as Objects' seem alien, see
-[link math_toolkit.dist.stat_tut.weg.NAG_library other statistics libraries.]
+[link math_toolkit.dist.stat_tut.weg.NAG_library the comparison to
+other statistics libraries.]
] [/tip]
Making distributions class types does two things:
@@ -47,8 +53,9 @@
Although the distribution classes in this library are templates, there
are typedefs on type /double/ that mostly take the usual name of the
distribution
-(except where there is a clash with a function name: beta, gamma, binomial,
-in which case using the default RealType = double is nearly as convenient).
+(except where there is a clash with a function of the same name: beta and gamma,
+in which case using the default template arguments - `RealType = double` -
+is nearly as convenient).
Probably 95% of uses are covered by these typedefs:
using namespace boost::math;
@@ -56,10 +63,9 @@
// Construct a students_t distribution with 4 degrees of freedom:
students_t d1(4);
- // Construct a double binomial distribution
- // with probability of success 0.3
- // and 20 trials in total:
- binomial_distribution<> d2(20, 0.3); // Note: _distribution<> !
+ // Construct a double-precision beta distribution
+ // with parameters a = 10, b = 20
+ beta_distribution<> d2(10, 20); // Note: _distribution<> suffix !
If you need to use the distributions with a type other than `double`,
then you can instantiate the template directly: the names of the
@@ -115,12 +121,11 @@
for example in a uniform, normal or triangular,
see [@http://www.boost.org/libs/random/ Boost.Random].
-The distributions in the random number library are typically much faster,
-but much less accurate than those in this library. This reflects the
-differing uses of the two libraries: if you want to conduct statistical
-tests, then you will need the reliable computation of this library,
-whereas random numbers are ['random]: so accuracy is not a concern, where
-as speed most certainly is.
+The distributions in the random number library are typically much faster
+to compute than the quantiles provided by this library: although
+in principal you can use a quantile to convert a uniformly distributed random
+number to another distribution, there are much faster algorithms
+available that are specific to random number generation.
] [/tip Random numbers that approximate Quantiles of Distributions]
For example, the binomial distribution has two parameters:
@@ -184,6 +189,7 @@
or `ceil` functions on the random variate prior to calling the distribution
function.
+TODO: this is out of date, rewrite when we have a tutorial to link to.
Likewise the `quantile` function will return a real value: users should use
either the `floor` or `ceil` functions to convert the result to the nearest
integer. However, whether it makes more sense to take the floor or the
Modified: sandbox/math_toolkit/libs/math/doc/distributions/NAG_library.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/NAG_library.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/NAG_library.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -28,11 +28,9 @@
The equivalent using this Boost C++ library is:
- using boost::math::binomial_distribution;
- // Get name in the right namespace (avoids very long names).
- binomial_distribution(RealType n, RealType p); // Default RealType is double,
+ using namespace boost::math; // Using declaration avoids very long names.
- binomial_distribution<>my_dist(4, 0.5); // NAG n = 4, p = 0.5
+ binomial my_dist(4, 0.5); // c.f. NAG n = 4, p = 0.5
and values can be output thus:
@@ -44,11 +42,11 @@
<< pdf(my_dist, 2) << endl; // NAG peqk with k = 2
-cdf(dist, k) is equivalent to NAG library plek, lower tail probability of <= k
+`cdf(dist, k)` is equivalent to NAG library `plek`, lower tail probability of <= k
-cdf(complement(dist, k)) is equivalent to NAG library pgtk, upper tail probability of > k
+`cdf(complement(dist, k))` is equivalent to NAG library `pgtk`, upper tail probability of > k
-pdf(dist, k) is equivalent to NAG library peqk, point probability of == k
+`pdf(dist, k)` is equivalent to NAG library `peqk`, point probability of == k
See [@../../example/binomial_example3.cpp binomial_example3.cpp] for details.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/Pareto.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/Pareto.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/Pareto.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -5,12 +5,13 @@
namespace boost{ namespace math{
- template <class RealType>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class pareto_distribution;
- typedef pareto_distribution<double> pareto;
+ typedef pareto_distribution<> pareto;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class pareto_distribution
{
public:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/Rayleigh.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/Rayleigh.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/Rayleigh.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -5,16 +5,18 @@
namespace boost{ namespace math{
- template <class RealType>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class rayleigh_distribution;
- typedef rayleigh_distribution<double> rayleigh;
+ typedef rayleigh_distribution<> rayleigh;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class rayleigh_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
// Construct:
rayleigh_distribution(RealType sigma = 1)
// Accessors:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/bernoulli.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/bernoulli.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/bernoulli.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -3,16 +3,18 @@
``#include <boost/math/distributions/bernoulli.hpp>``
namespace boost{ namespace math{
- template <class RealType>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class bernoulli_distribution;
- typedef bernoulli_distribution<double> bernoulli;
+ typedef bernoulli_distribution<> bernoulli;
- template <class RealType = double>
+ template <class RealType, class ``__Policy``>
class bernoulli_distribution
{
public:
- typedef RealType value_type;
+ typedef RealType value_type;
+ typedef Policy policy_type;
bernoulli_distribution(RealType p); // Constructor.
// Accessor function.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/beta.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/beta.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/beta.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,17 +4,20 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class beta_distribution;
// typedef beta_distribution<double> beta;
// Note that this is deliberately NOT provided,
// to avoid a clash with the function name beta.
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class beta_distribution
{
public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
// Constructor from two shape parameters, alpha & beta:
beta_distribution(RealType a, RealType b);
Modified: sandbox/math_toolkit/libs/math/doc/distributions/binomial.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/binomial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/binomial.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,18 +4,18 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class binomial_distribution;
- // typedef binomial_distribution<double> binomial;
- // Note that this is NOT provided to avoid a clash with the function name.
- // Use binomial_distribution<> myBinomial(...) to construct type double.
+ typedef binomial_distribution<> binomial;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class binomial_distribution
{
public:
- typedef RealType value_type;
+ typedef RealType value_type;
+ typedef Policy policy_type;
static const ``['unspecified-type]`` cloppper_pearson_exact_interval;
static const ``['unspecified-type]`` jeffreys_prior_interval;
Modified: sandbox/math_toolkit/libs/math/doc/distributions/binomial_example.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/binomial_example.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/binomial_example.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -1,6 +1,6 @@
[section:binom_eg Binomial Distribution Examples]
-See also the reference documentation for the __binomial_distrib.)
+See also the reference documentation for the __binomial_distrib.
[section:binom_conf Calculating Confidence Limits on the Frequency of Occurrence for a Binomial Distribution]
Modified: sandbox/math_toolkit/libs/math/doc/distributions/cauchy.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/cauchy.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/cauchy.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -2,11 +2,18 @@
``#include <boost/math/distributions/cauchy.hpp>``
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class cauchy_distribution;
+
+ typedef cauchy_distribution<> cauchy;
+
+ template <class RealType, class ``__Policy``>
class cauchy_distribution
{
public:
- typedef RealType value_type;
+ typedef RealType value_type;
+ typedef Policy policy_type;
cauchy_distribution(RealType location = 0, RealType scale = 1);
Modified: sandbox/math_toolkit/libs/math/doc/distributions/chi_squared.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/chi_squared.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/chi_squared.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,16 +4,18 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class chi_squared_distribution;
- typedef chi_squared_distribution<double> chi_squared;
+ typedef chi_squared_distribution<> chi_squared;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class chi_squared_distribution
{
public:
- typedef RealType value_type;
+ typedef RealType value_type;
+ typedef Policy policy_type;
// Constructor:
chi_squared_distribution(RealType i);
Modified: sandbox/math_toolkit/libs/math/doc/distributions/chi_squared_examples.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/chi_squared_examples.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/chi_squared_examples.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -158,26 +158,19 @@
[table
[[Hypothesis][Test]]
[[The null-hypothesis: there is no difference in standard deviation from the specified value]
- [ [chi][super 2][sub (1-alpha/2; N-1)] <= T <= [chi][super 2][sub (alpha/2; N-1)] ]]
+ [ Reject if T < [chi][super 2][sub (1-alpha/2; N-1)] or T > [chi][super 2][sub (alpha/2; N-1)] ]]
[[The alternative hypothesis: there is a difference in standard deviation from the specified value]
- [ [chi][super 2][sub (1-alpha/2; N-1)] > T or [chi][super 2][sub (alpha/2; N-1)] < T ]]
+ [ Reject if [chi][super 2][sub (1-alpha/2; N-1)] >= T >= [chi][super 2][sub (alpha/2; N-1)] ]]
[[The alternative hypothesis: the standard deviation is less than the specified value]
- [ [chi][super 2][sub (1-alpha; N-1)] > T ]]
+ [ Reject if [chi][super 2][sub (1-alpha; N-1)] <= T ]]
[[The alternative hypothesis: the standard deviation is greater than the specified value]
- [ [chi][super 2][sub (alpha; N-1)] < T ]]
+ [ Reject if [chi][super 2][sub (alpha; N-1)] >= T ]]
]
Where [chi][super 2][sub (alpha; N-1)] is the upper critical value of the
Chi Squared distribution, and [chi][super 2][sub (1-alpha; N-1)] is the
lower critical value.
-[note
-The table above is framed in terms of acceptance of hypothesis.
-However, good experimental design dictates that you should formulate
-a hypothesis and then try and reject it. You should therefore decide
-which of the above situations corresponds to your null-hypothesis, and
-reject it if the test given above ['fails].]
-
Recall that the lower critical value is the same
as the quantile, and the upper critical value is the same as the quantile
from the complement of the probability, that gives us the following code
Modified: sandbox/math_toolkit/libs/math/doc/distributions/error_handling_example.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/error_handling_example.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/error_handling_example.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -1,5 +1,7 @@
[section:error_eg Error Handling Example]
+TODO: this documentation is out of date, rewrite it!!
+
See [link math_toolkit.special.error_handling error handling]
for a detailed explanation of the mechanism of handling errors,
including the common "bad" arguments to distributions and functions.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/exponential.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/exponential.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/exponential.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -2,18 +2,24 @@
``#include <boost/math/distributions/exponential.hpp>``
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class exponential_distribution;
+
+ typedef exponential_distribution<> exponential;
+
+ template <class RealType, class ``__Policy``>
class exponential_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
exponential_distribution(RealType lambda = 1);
RealType lambda()const;
};
- typedef exponential_distribution<double> exponential;
The [@http://en.wikipedia.org/wiki/Exponential_distribution exponential distribution]
is a [@http://en.wikipedia.org/wiki/Probability_distribution continuous probability distribution]
Modified: sandbox/math_toolkit/libs/math/doc/distributions/extreme_value.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/extreme_value.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/extreme_value.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -2,7 +2,13 @@
``#include <boost/math/distributions/extreme.hpp>``
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class extreme_value_distribution;
+
+ typedef extreme_value_distribution<> extreme_value;
+
+ template <class RealType, class ``__Policy``>
class extreme_value_distribution
{
public:
@@ -14,8 +20,6 @@
RealType location()const;
};
- typedef extreme_value_distribution<double> extreme_value;
-
There are various
[@http://mathworld.wolfram.com/ExtremeValueDistribution.html extreme value distributions]
: this implementation represents the maximum case,
Modified: sandbox/math_toolkit/libs/math/doc/distributions/f_dist_example.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/f_dist_example.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/f_dist_example.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -66,28 +66,21 @@
[table
[[Hypothesis][Test]]
[[The null-hypothesis: there is no difference in standard deviations (two sided test)]
- [F[sub (1-alpha/2; N1-1, N2-1)] < F < F[sub (alpha/2; N1-1, N2-1)] ]]
+ [Reject if F <= F[sub (1-alpha/2; N1-1, N2-1)] or F >= F[sub (alpha/2; N1-1, N2-1)] ]]
[[The alternative hypothesis: there is a difference in means (two sided test)]
- [F < F[sub (1-alpha/2; N1-1, N2-1)] or F > F[sub (alpha/2; N1-1, N2-1)] ]]
+ [Reject if F[sub (1-alpha/2; N1-1, N2-1)] <= F <= F[sub (alpha/2; N1-1, N2-1)] ]]
[[The alternative hypothesis: Standard deviation of sample 1 is greater
than that of sample 2]
- [F > F[sub (alpha; N1-1, N2-1)] ]]
+ [Reject if F < F[sub (alpha; N1-1, N2-1)] ]]
[[The alternative hypothesis: Standard deviation of sample 1 is less
than that of sample 2]
- [F < F[sub (1-alpha; N1-1, N2-1)] ]]
+ [Reject if F > F[sub (1-alpha; N1-1, N2-1)] ]]
]
Where F[sub (1-alpha; N1-1, N2-1)] is the lower critical value of the F distribution
with degrees of freedom N1-1 and N2-1, and F[sub (alpha; N1-1, N2-1)] is the upper
critical value of the F distribution with degrees of freedom N1-1 and N2-1.
-[note
-The above tests are formulated in terms of ['acceptance] because it's
-easier to understand the concepts involved. However, good experimental
-design suggests that hypothesis should be ['rejected] not ['accepted].
-Therefore you should decide which of the above situations represents your
-null-hypothesis, and then reject the hypothesis only if the test above ['fails].]
-
The upper and lower critical values can be computed using the quantile function:
F[sub (1-alpha; N1-1, N2-1)] = `quantile(fisher_f(N1-1, N2-1), alpha)`
Modified: sandbox/math_toolkit/libs/math/doc/distributions/fisher.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/fisher.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/fisher.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,12 +4,13 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class fisher_f_distribution;
- typedef fisher_f_distribution<double> fisher_f;
+ typedef fisher_f_distribution<> fisher_f;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class fisher_f_distribution
{
public:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/gamma.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/gamma.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/gamma.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,11 +4,13 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class gamma_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
gamma_distribution(RealType shape, RealType scale = 1)
@@ -30,9 +32,14 @@
[note
To avoid potential confusion with the gamma functions, this
-distribution does not define a typedef
-`typedef gamma_distibution<double> gamma`, instead if you want
-a double precision gamma distribution you can use `boost::gamma_distribution<>`]
+distribution does not provide the typedef:
+
+``typedef gamma_distibution<double> gamma;``
+
+Instead if you want
+a double precision gamma distribution you can use
+
+``boost::gamma_distribution<>``]
For shape parameter /k/ and scale parameter [theta][space] it is defined by the
probability density function:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/lognormal.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/lognormal.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/lognormal.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,16 +4,18 @@
namespace boost{ namespace math{
- template <class RealType>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class lognormal_distribution;
- typedef lognormal_distribution<double> lognormal;
+ typedef lognormal_distribution<> lognormal;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class lognormal_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
// Construct:
lognormal_distribution(RealType location = 0, RealType scale = 1);
// Accessors:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,15 +4,18 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class negative_binomial_distribution;
- typedef negative_binomial_distribution<double> negative_binomial;
+ typedef negative_binomial_distribution<> negative_binomial;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class negative_binomial_distribution
{
public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
// Constructor from successes and success_fraction:
negative_binomial_distribution(RealType r, RealType p);
Modified: sandbox/math_toolkit/libs/math/doc/distributions/non_members.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/non_members.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/non_members.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -60,8 +60,8 @@
[h4 [#math.dist.cdf]Cumulative Distribution Function]
- template <class RealType>
- RealType cdf(const ``['Distribution-Type]``<RealType>& dist, const RealType& x);
+ template <class RealType, class ``__Policy``>
+ RealType cdf(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist, const RealType& x);
The __cdf is the probability that
the variable takes a value less than or equal to x. It is equivalent
@@ -105,8 +105,8 @@
[h4 [#math.dist.hazard]Hazard Function]
- template <class RealType>
- RealType hazard(const ``['Distribution-Type]``<RealType>& dist, const RealType& x);
+ template <class RealType, class ``__Policy``>
+ RealType hazard(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist, const RealType& x);
Returns the __hazard of /x/ and distibution /dist/.
@@ -121,8 +121,8 @@
[h4 [#math.dist.chf]Cumulative Hazard Function]
- template <class RealType>
- RealType chf(const ``['Distribution-Type]``<RealType>& dist, const RealType& x);
+ template <class RealType, class ``__Policy``>
+ RealType chf(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist, const RealType& x);
Returns the __chf of /x/ and distibution /dist/.
@@ -136,8 +136,8 @@
[h4 [#math.dist.mean]mean]
- template<class RealType>
- RealType mean(const ``['Distribution-Type]``<RealType>& dist);
+ template<class RealType, class ``__Policy``>
+ RealType mean(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the mean of the distribution /dist/.
@@ -146,15 +146,15 @@
[h4 [#math.dist.median]median]
- template<class RealType>
- RealType median(const ``['Distribution-Type]``<RealType>& dist);
+ template<class RealType, class ``__Policy``>
+ RealType median(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the median of the distribution /dist/.
[h4 [#math.dist.mode]mode]
- template<class RealType>
- RealType mode(const ``['Distribution-Type]``<RealType>& dist);
+ template<class RealType, ``__Policy``>
+ RealType mode(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the mode of the distribution /dist/.
@@ -163,8 +163,8 @@
[h4 [#math.dist.pdf]Probability Density Function]
- template <class RealType>
- RealType pdf(const ``['Distribution-Type]``<RealType>& dist, const RealType& x);
+ template <class RealType, class ``__Policy``>
+ RealType pdf(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist, const RealType& x);
For a continuous function, the probability density function (pdf) returns
the probability that the variate has the value x.
@@ -184,15 +184,15 @@
[h4 [#math.dist.range]range]
- template<class RealType>
- std::pair<RealType, RealType> range(const ``['Distribution-Type]``<RealType>& dist);
+ template<class RealType, class ``__Policy``>
+ std::pair<RealType, RealType> range(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the valid range of the random variable over distribution /dist/.
[h4 [#math.dist.quantile]Quantile]
- template <class RealType>
- RealType quantile(const ``['Distribution-Type]``<RealType>& dist, const RealType& p);
+ template <class RealType, class ``__Policy``>
+ RealType quantile(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist, const RealType& p);
The quantile is best viewed as the inverse of the __cdf, it returns
a value /x/ such that `cdf(dist, x) == p`.
@@ -242,8 +242,8 @@
[h4 [#math.dist.sd]Standard Deviation]
- template <class RealType>
- RealType standard_deviation(const ``['Distribution-Type]``<RealType>& dist);
+ template <class RealType, class ``__Policy``>
+ RealType standard_deviation(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the standard deviation of distribution /dist/.
@@ -252,8 +252,8 @@
[h4 [#math.dist.support]support]
- template<class RealType>
- std::pair<RealType, RealType> support(const ``['Distribution-Type]``<RealType>& dist);
+ template<class RealType, class ``__Policy``>
+ std::pair<RealType, RealType> support(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the supported range of random variable over the distribution /dist/.
@@ -266,8 +266,8 @@
[h4 [#math.dist.variance]Variance]
- template <class RealType>
- RealType variance(const ``['Distribution-Type]``<RealType>& dist);
+ template <class RealType, class ``__Policy``>
+ RealType variance(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the variance of the distribution /dist/.
@@ -276,8 +276,8 @@
[h4 [#math.dist.skewness]Skewness]
- template <class RealType>
- RealType skewness(const ``['Distribution-Type]``<RealType>& dist);
+ template <class RealType, class ``__Policy``>
+ RealType skewness(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the skewness of the distribution /dist/.
@@ -286,8 +286,8 @@
[h4 [#math.dist.kurtosis]Kurtosis]
- template <class RealType>
- RealType kurtosis(const ``['Distribution-Type]``<RealType>& dist);
+ template <class RealType, class ``__Policy``>
+ RealType kurtosis(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the 'proper' kurtosis (normalized fourth moment) of the distribution /dist/.
@@ -318,8 +318,8 @@
[h4 [#math.dist.kurtosis_excess]Kurtosis excess]
- template <class RealType>
- RealType kurtosis_excess(const ``['Distribution-Type]``<RealType>& dist);
+ template <class RealType, ``__Policy``>
+ RealType kurtosis_excess(const ``['Distribution-Type]``<RealType, ``__Policy``>& dist);
Returns the kurtosis excess of the distribution /dist/.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/normal.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/normal.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/normal.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,16 +4,18 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class normal_distribution;
- typedef normal_distribution<double> normal;
+ typedef normal_distribution<> normal;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class normal_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
// Construct:
normal_distribution(RealType mean = 0, RealType sd = 1);
// Accessors:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/poisson.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/poisson.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/poisson.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,15 +4,19 @@
namespace boost { namespace math {
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class poisson_distribution;
- typedef poisson_distribution<double> poisson;
+ typedef poisson_distribution<> poisson;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class poisson_distribution
{
public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
+
poisson_distribution(RealType mean = 1); // Constructor.
RealType mean()const; // Accessor.
}
Modified: sandbox/math_toolkit/libs/math/doc/distributions/students_t.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/students_t.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/students_t.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,15 +4,17 @@
namespace boost{ namespace math{
- template <class RealType = double>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class students_t_distribution;
- typedef students_t_distribution<double> students_t;
+ typedef students_t_distribution<> students_t;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class students_t_distribution
{
typedef RealType value_type;
+ typedef Policy policy_type;
// Construct:
students_t_distribution(const RealType& v);
Modified: sandbox/math_toolkit/libs/math/doc/distributions/students_t_examples.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/students_t_examples.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/students_t_examples.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -36,7 +36,7 @@
The usual assumptions of
[@http://en.wikipedia.org/wiki/Independent_and_identically-distributed_random_variables independent and identically distributed (i.i.d.)]
variables and [@http://en.wikipedia.org/wiki/Normal_distribution normal distribution]
-of course apply here, as they do in other examples.]
+of course apply here, as they do in other examples.
]
From the formula, it should be clear that:
@@ -262,27 +262,27 @@
[[Hypothesis][Test]]
[[The Null-hypothesis: there is
*no difference* in means]
-[Complement of CDF for |t| > significance level / 2:
+[Reject if complement of CDF for |t| < significance level / 2:
-`cdf(complement(dist, fabs(t))) > alpha / 2`]]
+`cdf(complement(dist, fabs(t))) < alpha / 2`]]
[[The Alternative-hypothesis: there is
*difference* in means]
-[Complement of CDF for |t| < significance level / 2:
+[Reject if complement of CDF for |t| > significance level / 2:
-`cdf(complement(dist, fabs(t))) < alpha / 2`]]
+`cdf(complement(dist, fabs(t))) > alpha / 2`]]
[[The Alternative-hypothesis: the sample mean is *less* than
the true mean.]
-[CDF of t < significance level:
+[Reject if CDF of t > significance level:
-`cdf(dist, t) < alpha`]]
+`cdf(dist, t) > alpha`]]
[[The Alternative-hypothesis: the sample mean is *greater* than
the true mean.]
-[Complement of CDF of t < significance level:
+[Reject if complement of CDF of t > significance level:
-`cdf(complement(dist, t)) < alpha`]]
+`cdf(complement(dist, t)) > alpha`]]
]
[note
@@ -604,28 +604,28 @@
[[Hypothesis][Test][C++ Code]]
[[The Null-hypothesis: there is
*no difference* in means]
-[Complement of CDF for |t| > significance level / 2:
+[Reject if complement of CDF for |t| < significance level / 2:
-`cdf(complement(dist, fabs(t))) > alpha / 2`]]
+`cdf(complement(dist, fabs(t))) < alpha / 2`]]
[[The Alternative-hypothesis: there is a
*difference* in means]
-[Complement of CDF for |t| < significance level / 2:
+[Reject if complement of CDF for |t| > significance level / 2:
`cdf(complement(dist, fabs(t))) < alpha / 2`]]
[[The Alternative-hypothesis: Sample 1 Mean is *less* than
Sample 2 Mean.]
-[CDF of t < significance level:
+[Reject if CDF of t > significance level:
-`cdf(dist, t) < alpha`]]
+`cdf(dist, t) > alpha`]]
[[The Alternative-hypothesis: Sample 1 Mean is *greater* than
Sample 2 Mean.]
-[Complement of CDF of t < significance level:
+[Reject if complement of CDF of t > significance level:
-`cdf(complement(dist, t)) < alpha`]]
+`cdf(complement(dist, t)) > alpha`]]
]
[note
Modified: sandbox/math_toolkit/libs/math/doc/distributions/triangular.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/triangular.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/triangular.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,16 +4,18 @@
``#include <boost/math/distributions/triangular.hpp>``
namespace boost{ namespace math{
- template <class RealType>
- class triangular_distribution;
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class triangular_distribution;
- typedef triangular_distribution<double> triangular;
+ typedef triangular_distribution<> triangular;
- template <class RealType = double>
+ template <class RealType, class ``__Policy``>
class triangular_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
triangular_distribution(RealType lower = -1, RealType mode = 0) RealType upper = 1); // Constructor.
: m_lower(lower), m_mode(mode), m_upper(upper) // Default is -1, 0, +1 triangular distribution.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/uniform.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/uniform.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/uniform.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -4,12 +4,13 @@
``#include <boost/math/distributions/uniform.hpp>``
namespace boost{ namespace math{
- template <class RealType>
- class uniform_distribution;
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class uniform_distribution;
- typedef uniform_distribution<double> uniform;
+ typedef uniform_distribution<> uniform;
- template <class RealType = double>
+ template <class RealType, class ``__Policy``>
class uniform_distribution
{
public:
Modified: sandbox/math_toolkit/libs/math/doc/distributions/weibull.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/weibull.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/weibull.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -5,16 +5,18 @@
namespace boost{ namespace math{
- template <class RealType>
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
class weibull_distribution;
- typedef weibull_distribution<double> weibull;
+ typedef weibull_distribution<> weibull;
- template <class RealType>
+ template <class RealType, class ``__Policy``>
class weibull_distribution
{
public:
typedef RealType value_type;
+ typedef Policy policy_type;
// Construct:
weibull_distribution(RealType shape, RealType scale = 1)
// Accessors:
Modified: sandbox/math_toolkit/libs/math/doc/math.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/math.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/math.qbk 2007-07-26 08:50:29 EDT (Thu, 26 Jul 2007)
@@ -179,6 +179,10 @@
[def __F_distrib [link math_toolkit.dist.dist_ref.dists.f_dist Fisher F Distribution]]
[def __students_t_distrib [link math_toolkit.dist.dist_ref.dists.students_t_dist Students t Distribution]]
+[/links to policy]
+[def __Policy [link math_toolkit.policy Policy]]
+[def __policy_class [link math_toolkit.policy.pol_ref.pol_ref_ref policy::policy<>]]
+
[def __usual_accessors __cdf, __pdf, __quantile, __hazard,
__chf, __mean, __median, __mode, __variance, __sd, __skewness,
__kurtosis, __kurtosis_excess, __range and __support]
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