Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2007-08-03 06:10:13


Author: pbristow
Date: 2007-08-03 06:10:12 EDT (Fri, 03 Aug 2007)
New Revision: 38412
URL: http://svn.boost.org/trac/boost/changeset/38412

Log:
Paul's Big policy revison
Text files modified:
   sandbox/math_toolkit/libs/math/doc/distributions/cauchy.qbk | 9 +++++++--
   sandbox/math_toolkit/libs/math/doc/issues.qbk | 6 ++----
   sandbox/math_toolkit/libs/math/doc/math.qbk | 3 ++-
   sandbox/math_toolkit/libs/math/doc/policy.qbk | 30 ++++++++++++++++++++++++++----
   4 files changed, 37 insertions(+), 11 deletions(-)

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-08-03 06:10:12 EDT (Fri, 03 Aug 2007)
@@ -75,8 +75,13 @@
 All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
 that are generic to all distributions are supported: __usual_accessors.
 
-Note however that the Cauchy distribution does not have a mean or
-standard deviation. Therefore, the functions __mean, __sd,
+Note however that the Cauchy distribution does not have a mean,
+standard deviation, etc. See __math_undefined
+[/link math_toolkit.policy.pol_ref.assert_undefined mathematically undefined function]
+to control whether these should fail to compile with a BOOST_STATIC_ASSERTION_FAILURE,
+which is the default.
+
+Alternately, the functions __mean, __sd,
 __variance, __skewness, __kurtosis and __kurtosis_excess will all
 return a __domain_error if called.
 

Modified: sandbox/math_toolkit/libs/math/doc/issues.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/issues.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/issues.qbk 2007-08-03 06:10:12 EDT (Fri, 03 Aug 2007)
@@ -37,13 +37,13 @@
 
 [h4 Elliptic Integrals]
 
-* Carlsons algorithms are essentially unchanged from Xiaogang Zhang's
+* Carlson's algorithms are essentially unchanged from Xiaogang Zhang's
 Google Summer of Code student project, and are based on Carlson's
 original papers. However, Carlson has revised his algorithms since then
 (refer to the references in the elliptic integral docs for a list), to
 improve performance and accuracy, we may be able to take advantage
 of these improvements too (Low Priority).
-* Carlsons algorithms (mainly R[sub J]) are somewhat prone to
+* Carlson's algorithms (mainly R[sub J]) are somewhat prone to
 internal overflow/underflow when the arguments are very large or small.
 The homogeneity relations: \n
 R[sub F](ka, kb, kc) = k[super -1/2] R[sub F](a, b, c)\n
@@ -80,8 +80,6 @@
 
 * Student's t Perhaps switch to normal distribution as a better approximation for very large degrees of freedom?
 
-* Some distributions say the range may include infinity, but is not always implemented; nor is it clear if and how it should be.
-
 [endsect][/section:issues Known Issues, and Todo List]
 
 [/

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-08-03 06:10:12 EDT (Fri, 03 Aug 2007)
@@ -181,7 +181,8 @@
 
 [/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 __policy_class [link math_toolkit.policy.pol_ref.pol_ref_ref policies::policy<>]]
+[def __math_undefined [link math_toolkit.policy.pol_ref.assert_undefined mathematically undefined function]]
 
 [def __usual_accessors __cdf, __pdf, __quantile, __hazard,
    __chf, __mean, __median, __mode, __variance, __sd, __skewness,

Modified: sandbox/math_toolkit/libs/math/doc/policy.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/policy.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/policy.qbk 2007-08-03 06:10:12 EDT (Fri, 03 Aug 2007)
@@ -335,7 +335,7 @@
 
 This behaviour is controlled by the `assert_undefined<>` policy:
 
- namespace boost{ namespace math{ namespace policy{
+ namespace boost{ namespace math{ namespace policies {
 
    template <bool b>
    class assert_undefined;
@@ -579,9 +579,22 @@
 
 [section:policy_defaults Changing the Policy Defaults]
 
-If you want to alter the defaults for any of
-the policies then you can do so by defining various macros in
-boost/math/tools/user.hpp:
+You can use the various macros below to change any (or all) of the policies.
+
+You can make a local change by placing a macro definition *before*
+a function or distribution #include.
+
+[caution If you place it after the #include it will have no effect,
+(or it will affect only any other following #includes).]
+
+[caution There is a danger of One-Definition-Rule violations if you
+add ad-hock macros to more than one source files: these must be set the same in *every
+translation unit*.]
+
+If you want to alter the defaults for any or all of
+the policies for *all* functions and distributions, installation-wide,
+then you can do so by defining various macros in
+boost/math/tools/user.hpp.
 
 [h5 BOOST_MATH_DOMAIN_ERROR_POLICY]
 
@@ -675,6 +688,14 @@
    #define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error
    #define BOOST_MATH_DISCRETE_QUANTILE_POLICY real
    #define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
+
+or we could place these definitions *before*
+
+ #include <boost/math/distributions/normal.hpp>
+ using boost::math::normal_distribution;
+
+in a source .cpp file.
+[/ TODO could use a normal example here?]
 
 [endsect][/section:policy_defaults Changing the Policy Defaults]
 
@@ -936,3 +957,4 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]
 
+


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