|
Boost-Commit : |
From: john_at_[hidden]
Date: 2008-05-12 12:39:26
Author: johnmaddock
Date: 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
New Revision: 45301
URL: http://svn.boost.org/trac/boost/changeset/45301
Log:
Extended TR1 and C99 C compatible docs.
Misc other doc fixes.
Fixed sign of assoc_legendre result.
Added:
sandbox/math_toolkit/libs/math/doc/sf_and_dist/c99_ref.qbk (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.mml (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.png (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.svg (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.mml (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.png (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.svg (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/ellint_carlson.png (contents, props changed)
sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1_ref.qbk (contents, props changed)
Text files modified:
sandbox/math_toolkit/libs/math/doc/sf_and_dist/credits.qbk | 3 +
sandbox/math_toolkit/libs/math/doc/sf_and_dist/ellint_legendre.qbk | 2
sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk | 24 +++++++++++++
sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1.qbk | 67 +++++++++++++++++++++++++++++++++------
sandbox/math_toolkit/libs/math/src/tr1/assoc_legendre.cpp | 2
sandbox/math_toolkit/libs/math/src/tr1/assoc_legendref.cpp | 2
sandbox/math_toolkit/libs/math/src/tr1/assoc_legendrel.cpp | 2
7 files changed, 86 insertions(+), 16 deletions(-)
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/c99_ref.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/c99_ref.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -0,0 +1,297 @@
+[section:c99 C99 C Functions]
+
+[h4 Supported C99 Functions]
+
+ namespace boost{ namespace math{ namespace tr1{ extern "C"{
+
+ typedef unspecified float_t;
+ typedef unspecified double_t;
+
+ double acosh(double x);
+ float acoshf(float x);
+ long double acoshl(long double x);
+
+ double asinh(double x);
+ float asinhf(float x);
+ long double asinhl(long double x);
+
+ double atanh(double x);
+ float atanhf(float x);
+ long double atanhl(long double x);
+
+ double cbrt(double x);
+ float cbrtf(float x);
+ long double cbrtl(long double x);
+
+ double copysign(double x, double y);
+ float copysignf(float x, float y);
+ long double copysignl(long double x, long double y);
+
+ double erf(double x);
+ float erff(float x);
+ long double erfl(long double x);
+
+ double erfc(double x);
+ float erfcf(float x);
+ long double erfcl(long double x);
+
+ double expm1(double x);
+ float expm1f(float x);
+ long double expm1l(long double x);
+
+ double fmax(double x, double y);
+ float fmaxf(float x, float y);
+ long double fmaxl(long double x, long double y);
+
+ double fmin(double x, double y);
+ float fminf(float x, float y);
+ long double fminl(long double x, long double y);
+
+ double hypot(double x, double y);
+ float hypotf(float x, float y);
+ long double hypotl(long double x, long double y);
+
+ double lgamma(double x);
+ float lgammaf(float x);
+ long double lgammal(long double x);
+
+ long long llround(double x);
+ long long llroundf(float x);
+ long long llroundl(long double x);
+
+ double log1p(double x);
+ float log1pf(float x);
+ long double log1pl(long double x);
+
+ long lround(double x);
+ long lroundf(float x);
+ long lroundl(long double x);
+
+ double nextafter(double x, double y);
+ float nextafterf(float x, float y);
+ long double nextafterl(long double x, long double y);
+
+ double nexttoward(double x, long double y);
+ float nexttowardf(float x, long double y);
+ long double nexttowardl(long double x, long double y);
+
+ double round(double x);
+ float roundf(float x);
+ long double roundl(long double x);
+
+ double tgamma(double x);
+ float tgammaf(float x);
+ long double tgammal(long double x);
+
+ double trunc(double x);
+ float truncf(float x);
+ long double truncl(long double x);
+
+ }}}} // namespaces
+
+In addition sufficient additional overloads of the `double` versions of the
+above functions are provided, so that calling the function with any mixture
+of `float`, `double`, `long double`, or /integer/ arguments is supported, with the
+return type determined by the __arg_pomotion_rules.
+
+For example:
+
+ acoshf(2.0f); // float version, returns float.
+ acosh(2.0f); // also calls the float version and returns float.
+ acosh(2.0); // double version, returns double.
+ acoshl(2.0L); // long double version, returns a long double.
+ acosh(2.0L); // also calls the long double version.
+ acosh(2); // integer argument is treated as a double, returns double.
+
+[h4 Quick Reference]
+
+More detailed descriptions of these functions are available in the
+C99 standard.
+
+ typedef unspecified float_t;
+ typedef unspecified double_t;
+
+In this implementation `float_t` is the same as type `float`, and
+`double_t` the same as type `double` unless the preprocessor symbol
+FLT_EVAL_METHOD is defined, in which case these are set as follows:
+
+[table
+[[FLT_EVAL_METHOD][float_t][double_t]]
+[[0][float][double]]
+[[1][double][double]]
+[[2][long double][long double]]
+]
+
+ double acosh(double x);
+ float acoshf(float x);
+ long double acoshl(long double x);
+
+Returns the inverse hyperbolic cosine of /x/.
+
+See also __acosh for the full template (header only) version of this function.
+
+ double asinh(double x);
+ float asinhf(float x);
+ long double asinhl(long double x);
+
+Returns the inverse hyperbolic sine of /x/.
+
+See also __asinh for the full template (header only) version of this function.
+
+ double atanh(double x);
+ float atanhf(float x);
+ long double atanhl(long double x);
+
+Returns the inverse hyperbolic tangent of /x/.
+
+See also __atanh for the full template (header only) version of this function.
+
+ double cbrt(double x);
+ float cbrtf(float x);
+ long double cbrtl(long double x);
+
+Returns the cubed root of /x/.
+
+See also __cbrt for the full template (header only) version of this function.
+
+ double copysign(double x, double y);
+ float copysignf(float x, float y);
+ long double copysignl(long double x, long double y);
+
+Returns a value with the magnitude of /x/ and the sign of /y/.
+
+ double erf(double x);
+ float erff(float x);
+ long double erfl(long double x);
+
+Returns the error function of /x/:
+
+[equation erf1]
+
+See also __erf for the full template (header only) version of this function.
+
+ double erfc(double x);
+ float erfcf(float x);
+ long double erfcl(long double x);
+
+Returns the complementary error function of /x/ `1-erf(x)` without the loss
+of precision implied by the subtraction.
+
+See also __erfc for the full template (header only) version of this function.
+
+ double expm1(double x);
+ float expm1f(float x);
+ long double expm1l(long double x);
+
+Returns `exp(x)-1` without the loss
+of precision implied by the subtraction.
+
+See also __expm1 for the full template (header only) version of this function.
+
+ double fmax(double x, double y);
+ float fmaxf(float x, float y);
+ long double fmaxl(long double x, long double y);
+
+Returns the larger (most positive) of /x/ and /y/.
+
+ double fmin(double x, double y);
+ float fminf(float x, float y);
+ long double fminl(long double x, long double y);
+
+Returns the smaller (most negative) of /x/ and /y/.
+
+ double hypot(double x, double y);
+ float hypotf(float x, float y);
+ long double hypotl(long double x, long double y);
+
+Returns `sqrt(x*x + y*y)` without the danger of numeric overflow
+implied by that formulation.
+
+See also __hypot for the full template (header only) version of this function.
+
+ double lgamma(double x);
+ float lgammaf(float x);
+ long double lgammal(long double x);
+
+Returns the log of the gamma function of /x/.
+
+[equation lgamm1]
+
+See also __lgamma for the full template (header only) version of this function.
+
+ long long llround(double x);
+ long long llroundf(float x);
+ long long llroundl(long double x);
+
+Returns the value /x/ rounded to the nearest integer as a `long long`:
+equivalent to `floor(x + 0.5)`
+
+See also __llround for the full template (header only) version of this function.
+
+ double log1p(double x);
+ float log1pf(float x);
+ long double log1pl(long double x);
+
+Returns the `log(x+1)` without the loss of precision
+implied by that formulation.
+
+See also __log1p for the full template (header only) version of this function.
+
+ long lround(double x);
+ long lroundf(float x);
+ long lroundl(long double x);
+
+Returns the value /x/ rounded to the nearest integer as a `long`:
+equivalent to `floor(x + 0.5)`
+
+See also __lround for the full template (header only) version of this function.
+
+ double nextafter(double x, double y);
+ float nextafterf(float x, float y);
+ long double nextafterl(long double x, long double y);
+
+Returns the next representable floating point number after /x/
+in the direction of /y/, or /x/ if `x == y`.
+
+ double nexttoward(double x, long double y);
+ float nexttowardf(float x, long double y);
+ long double nexttowardl(long double x, long double y);
+
+As `nextafter`, but with /y/ always expressed as a `long double`.
+
+ double round(double x);
+ float roundf(float x);
+ long double roundl(long double x);
+
+Returns the value /x/ rounded to the nearest integer:
+equivalent to `floor(x + 0.5)`
+
+See also __round for the full template (header only) version of this function.
+
+ double tgamma(double x);
+ float tgammaf(float x);
+ long double tgammal(long double x);
+
+Returns the gamma function of /x/:
+
+[equation gamm1]
+
+See also __tgamma for the full template (header only) version of this function.
+
+ double trunc(double x);
+ float truncf(float x);
+ long double truncl(long double x);
+
+Returns /x/ truncated to the nearest integer.
+
+See also __trunc for the full template (header only) version of this function.
+
+[endsect]
+
+[/
+ Copyright 2008 John Maddock and Paul A. Bristow.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/credits.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/credits.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/credits.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -20,6 +20,8 @@
Xiaogang Zhang worked on the Bessel functions and elliptic integrals for his
Google Summer of Code project 2006.
+Bruno Lalande submitted the "compile time power of a runtime base" code.
+
Professor Nico Temme for advice on the inverse incomplete beta function.
[@http://www.shoup.net Victor Shoup for NTL],
@@ -58,3 +60,4 @@
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
+
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/ellint_legendre.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/ellint_legendre.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/ellint_legendre.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -161,7 +161,7 @@
template <class T>
``__sf_result`` ellint_2(T k, const ``__Policy``&);
-Returns the complete elliptic integral of the first kind ['E(k)]:
+Returns the complete elliptic integral of the second kind ['E(k)]:
[equation ellint7]
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.mml 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -0,0 +1,85 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
+ 'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
+ [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head><title>legendre_1b</title>
+<!-- MathML created with MathCast Equation Editor version 0.88 -->
+</head>
+<body>
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mtext>legendre_p</mtext>
+ <mfenced>
+ <mrow>
+ <mi>l</mi>
+ <mo>,</mo>
+ <mi>m</mi>
+ <mo>,</mo>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <msubsup>
+ <mi>P</mi>
+ <mrow>
+ <mi>l</mi>
+ </mrow>
+ <mi>m</mi>
+ </msubsup>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <msup>
+ <mfenced>
+ <mrow>
+ <mn>1</mn>
+ <mo>−</mo>
+ <msup>
+ <mi>x</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </mfenced>
+ <mrow>
+ <mfrac>
+ <mi>m</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+ </msup>
+ <mfrac>
+ <mrow>
+ <msup>
+ <mi>d</mi>
+ <mi>m</mi>
+ </msup>
+ <msub>
+ <mi>P</mi>
+ <mi>l</mi>
+ </msub>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+ <mrow>
+ <mi>d</mi>
+ <msup>
+ <mi>x</mi>
+ <mi>m</mi>
+ </msup>
+ </mrow>
+ </mfrac>
+ </mrow>
+</math>
+</body>
+</html>
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.png
==============================================================================
Binary file. No diff available.
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/legendre_1b.svg
==============================================================================
Binary file. No diff available.
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.mml 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -0,0 +1,105 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
+ 'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
+ [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head><title>spherical_3</title>
+<!-- MathML created with MathCast Equation Editor version 0.88 -->
+</head>
+<body>
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mtext>sph_legendre</mtext>
+ <mfenced>
+ <mrow>
+ <mi>l</mi>
+ <mo>,</mo>
+ <mi>m</mi>
+ <mo>,</mo>
+ <mi>θ</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <msubsup>
+ <mi>Y</mi>
+ <mrow>
+ <mi>l</mi>
+ </mrow>
+ <mi>m</mi>
+ </msubsup>
+ <mfenced>
+ <mrow>
+ <mi>θ</mi>
+ <mo>,</mo>
+ <mn>0</mn>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <msup>
+ <mfenced>
+ <mrow>
+ <mo>−</mo>
+ <mn>1</mn>
+ </mrow>
+ </mfenced>
+ <mi>m</mi>
+ </msup>
+ <msqrt>
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mn>2</mn>
+ <mi>l</mi>
+ <mo>+</mo>
+ <mn>1</mn>
+ </mrow>
+ <mrow>
+ <mn>4</mn>
+ <mi>π</mi>
+ </mrow>
+ </mfrac>
+ <mfrac>
+ <mrow>
+ <mfenced>
+ <mrow>
+ <mi>l</mi>
+ <mo>−</mo>
+ <mi>m</mi>
+ </mrow>
+ </mfenced>
+ <mo>!</mo>
+ </mrow>
+ <mrow>
+ <mfenced>
+ <mrow>
+ <mi>l</mi>
+ <mo>+</mo>
+ <mi>m</mi>
+ </mrow>
+ </mfenced>
+ <mo>!</mo>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </msqrt>
+ <msubsup>
+ <mi>P</mi>
+ <mrow>
+ <mi>l</mi>
+ </mrow>
+ <mi>m</mi>
+ </msubsup>
+ <mfenced>
+ <mrow>
+ <mi>cos</mi>
+ <mi>θ</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+</math>
+</body>
+</html>
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.png
==============================================================================
Binary file. No diff available.
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/spherical_3.svg
==============================================================================
Binary file. No diff available.
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/ellint_carlson.png
==============================================================================
Binary file. No diff available.
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -34,6 +34,7 @@
[include html4_symbols.qbk] [/ just for testing]
[/include latin1_symbols.qbk] [/ just for testing]
[include common_overviews.qbk] [/ overviews that appear in more than one place!]
+[include tr1.qbk] [/tr1 docs also appear in more than one place!]
[include roadmap.qbk] [/ for history]
[def __effects [*Effects: ]]
@@ -183,9 +184,19 @@
[/rounding]
[def __round [link math_toolkit.special.rounding.round round]]
+[def __lround [link math_toolkit.special.rounding.round round]]
+[def __llround [link math_toolkit.special.rounding.round round]]
[def __trunc [link math_toolkit.special.rounding.trunc trunc]]
[def __modf [link math_toolkit.special.rounding.modf modf]]
+[/polynomials]
+[def __laguerre [link math_toolkit.special.sf_poly.laguerre laguerre]]
+[def __legendre [link math_toolkit.special.sf_poly.legendre legendre_p]]
+[def __hermite [link math_toolkit.special.sf_poly.hermite hermite]]
+
+[/Misc]
+[def __expint [link math_toolkit.special.expint.expint_i expint]]
+[def __spherical_harmonic [link math_toolkit.special.sf_poly.sph_harm spherical_harmonic]]
@@ -322,7 +333,9 @@
[section:history1 History and What's New]
[history]
[endsect]
-[include tr1.qbk]
+[section:tr1 C99 and TR1 C Functions]
+[tr1_overview]
+[endsect]
[include contact_info.qbk]
[endsect] [/section:main_overview Overview]
@@ -390,6 +403,15 @@
[include rounding_func.qbk]
[include fpclassify.qbk]
[include float_next.qbk]
+
+[section:extern_c TR1 and C99 external "C" Functions]
+[section:tr1 C99 and TR1 C Functions Overview]
+[tr1_overview]
+[endsect]
+[include c99_ref.qbk]
+[include tr1_ref.qbk]
+[endsect]
+
[endsect] [/section:special Special Functions]
[section:toolkit Internal Details and Tools (Experimental)]
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -1,5 +1,4 @@
-[section:tr1 C99 and TR1 C Functions]
-
+[template tr1_overview[]
Many of the special functions included in this library are also a part
of the either the C99 standard or the [tr1]. Therefore this library
includes a thin wrapper header `boost/math/tr1.hpp` that provides
@@ -20,6 +19,10 @@
* Error handling is handled via setting ::errno and returning NaN's and
infinities: this may be less flexible than an C++ exception based approach.
+[note The separate libraries are required *only* if you choose to use
+boost/math/tr1.hpp rather than some other Boost.Math header, the rest
+of Boost.Math remains header-only.]
+
The separate libraries required in order to use tr1.hpp can be compiled
using bjam from within the libs/math/build directory, or from the Boost
root directory using the usual Boost-wide install procedure.
@@ -38,18 +41,60 @@
]
Where `<suffix>` encodes the compiler and build options used to
-build the libraries.
+build the libraries: for example "libboost_math_tr1-vc80-mt-gd.lib"
+would be the statically linked TR1 library to use with Visual C++ 8.0,
+in multithreading debug mode, with the DLL VC++ runtime, where as
+"boost_math_tr1-vc80-mt.lib" would be import library for the TR1 DLL
+to be used with Visual C++ 8.0 with the release multithreaded DLL
+VC++ runtime.
+Refer to the getting started guide for a
+[@http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#library-naming
+full explanation of the `<suffix>` meanings].
[note
-Visual C++ users will need to define BOOST_MATH_TR1_DYN_LINK when building
+Visual C++ users will typically have the correct library variant to link
+against selected for them by boost/math/tr1.hpp based on your compiler
+settings.
+
+Users will need to define BOOST_MATH_TR1_DYN_LINK when building
their code if they want to link against the DLL versions of these libraries
-rather than the static versions.]
+rather than the static versions.
-There is no detailed documentation for these functions as that is
-available elsewhere - for example as part of the relevant standards,
-or in the [link math_toolkit.special special functions chapter]
-of this documentation. The
-following synopsis lists the functions that are currently supported:
+Users can disable auto-linking by defining BOOST_MATH_TR1_NO_LIB when
+building: this is typically only used when linking against a customised
+build of the libraries.]
+
+[note Linux and Unix users will generally only have one variant of
+these libraries installed, and can generally just link against
+-lboost_math_tr1 etc.]
+
+[h4 Usage Recomendations]
+
+This library now presents the user with a choice:
+
+* To include the header only versions of the functions and have
+an easier time linking, but a longer compile time.
+* To include the TR1 headers and link against an external library.
+
+Which option you choose depends largely on how you prefer to work
+and how your system is set up.
+
+For example a casual user who just needs the acosh function, would
+probably be better off including `<boost/math/special_functions/acosh.hpp>`
+and using `boost::math::acosh(x)` in their code.
+
+However, for large scale
+software development where compile times are significant, and where the
+Boost libraries are already built and installed on the system, then
+including `<boost/math/tr1.hpp>` and using `boost::math::tr1::acosh(x)`
+will speed up compile times, reduce object files sizes (since there are
+no templates being instantiated any more), and also speed up debugging
+runtimes - since the externally compiled libraries can be
+compiler optimised, rather than built using full settings - the difference
+in performance between
+[link math_toolkit.perf.getting_best
+release and debug builds can be as much as 20 times],
+so for complex applications this can be a big win.
[h4 Supported C99 Functions]
@@ -334,7 +379,7 @@
long double x);
-[endsect]
+]
[/
Copyright 2008 John Maddock and Paul A. Bristow.
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1_ref.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/tr1_ref.qbk 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -0,0 +1,393 @@
+[section:tr1_ref TR1 C Functions Quick Reference]
+
+
+[h4 Supported TR1 Functions]
+
+ namespace boost{ namespace math{ namespace tr1{ extern "C"{
+
+ // [5.2.1.1] associated Laguerre polynomials:
+ double assoc_laguerre(unsigned n, unsigned m, double x);
+ float assoc_laguerref(unsigned n, unsigned m, float x);
+ long double assoc_laguerrel(unsigned n, unsigned m, long double x);
+
+ // [5.2.1.2] associated Legendre functions:
+ double assoc_legendre(unsigned l, unsigned m, double x);
+ float assoc_legendref(unsigned l, unsigned m, float x);
+ long double assoc_legendrel(unsigned l, unsigned m, long double x);
+
+ // [5.2.1.3] beta function:
+ double beta(double x, double y);
+ float betaf(float x, float y);
+ long double betal(long double x, long double y);
+
+ // [5.2.1.4] (complete) elliptic integral of the first kind:
+ double comp_ellint_1(double k);
+ float comp_ellint_1f(float k);
+ long double comp_ellint_1l(long double k);
+
+ // [5.2.1.5] (complete) elliptic integral of the second kind:
+ double comp_ellint_2(double k);
+ float comp_ellint_2f(float k);
+ long double comp_ellint_2l(long double k);
+
+ // [5.2.1.6] (complete) elliptic integral of the third kind:
+ double comp_ellint_3(double k, double nu);
+ float comp_ellint_3f(float k, float nu);
+ long double comp_ellint_3l(long double k, long double nu);
+
+ // [5.2.1.8] regular modified cylindrical Bessel functions:
+ double cyl_bessel_i(double nu, double x);
+ float cyl_bessel_if(float nu, float x);
+ long double cyl_bessel_il(long double nu, long double x);
+
+ // [5.2.1.9] cylindrical Bessel functions (of the first kind):
+ double cyl_bessel_j(double nu, double x);
+ float cyl_bessel_jf(float nu, float x);
+ long double cyl_bessel_jl(long double nu, long double x);
+
+ // [5.2.1.10] irregular modified cylindrical Bessel functions:
+ double cyl_bessel_k(double nu, double x);
+ float cyl_bessel_kf(float nu, float x);
+ long double cyl_bessel_kl(long double nu, long double x);
+
+ // [5.2.1.11] cylindrical Neumann functions;
+ // cylindrical Bessel functions (of the second kind):
+ double cyl_neumann(double nu, double x);
+ float cyl_neumannf(float nu, float x);
+ long double cyl_neumannl(long double nu, long double x);
+
+ // [5.2.1.12] (incomplete) elliptic integral of the first kind:
+ double ellint_1(double k, double phi);
+ float ellint_1f(float k, float phi);
+ long double ellint_1l(long double k, long double phi);
+
+ // [5.2.1.13] (incomplete) elliptic integral of the second kind:
+ double ellint_2(double k, double phi);
+ float ellint_2f(float k, float phi);
+ long double ellint_2l(long double k, long double phi);
+
+ // [5.2.1.14] (incomplete) elliptic integral of the third kind:
+ double ellint_3(double k, double nu, double phi);
+ float ellint_3f(float k, float nu, float phi);
+ long double ellint_3l(long double k, long double nu, long double phi);
+
+ // [5.2.1.15] exponential integral:
+ double expint(double x);
+ float expintf(float x);
+ long double expintl(long double x);
+
+ // [5.2.1.16] Hermite polynomials:
+ double hermite(unsigned n, double x);
+ float hermitef(unsigned n, float x);
+ long double hermitel(unsigned n, long double x);
+
+ // [5.2.1.18] Laguerre polynomials:
+ double laguerre(unsigned n, double x);
+ float laguerref(unsigned n, float x);
+ long double laguerrel(unsigned n, long double x);
+
+ // [5.2.1.19] Legendre polynomials:
+ double legendre(unsigned l, double x);
+ float legendref(unsigned l, float x);
+ long double legendrel(unsigned l, long double x);
+
+ // [5.2.1.20] Riemann zeta function:
+ double riemann_zeta(double);
+ float riemann_zetaf(float);
+ long double riemann_zetal(long double);
+
+ // [5.2.1.21] spherical Bessel functions (of the first kind):
+ double sph_bessel(unsigned n, double x);
+ float sph_besself(unsigned n, float x);
+ long double sph_bessell(unsigned n, long double x);
+
+ // [5.2.1.22] spherical associated Legendre functions:
+ double sph_legendre(unsigned l, unsigned m, double theta);
+ float sph_legendref(unsigned l, unsigned m, float theta);
+ long double sph_legendrel(unsigned l, unsigned m, long double theta);
+
+ // [5.2.1.23] spherical Neumann functions;
+ // spherical Bessel functions (of the second kind):
+ double sph_neumann(unsigned n, double x);
+ float sph_neumannf(unsigned n, float x);
+ long double sph_neumannl(unsigned n, long double x);
+
+ }}}} // namespaces
+
+In addition sufficient additional overloads of the `double` versions of the
+above functions are provided, so that calling the function with any mixture
+of `float`, `double`, `long double`, or /integer/ arguments is supported, with the
+return type determined by the __arg_pomotion_rules.
+
+For example:
+
+ expintf(2.0f); // float version, returns float.
+ expint(2.0f); // also calls the float version and returns float.
+ expint(2.0); // double version, returns double.
+ expintl(2.0L); // long double version, returns a long double.
+ expint(2.0L); // also calls the long double version.
+ expint(2); // integer argument is treated as a double, returns double.
+
+[h4 Quick Reference]
+
+ // [5.2.1.1] associated Laguerre polynomials:
+ double assoc_laguerre(unsigned n, unsigned m, double x);
+ float assoc_laguerref(unsigned n, unsigned m, float x);
+ long double assoc_laguerrel(unsigned n, unsigned m, long double x);
+
+The assoc_laguerre functions return:
+
+[equation laguerre_1]
+
+See also __laguerre for the full template (header only) version of this function.
+
+ // [5.2.1.2] associated Legendre functions:
+ double assoc_legendre(unsigned l, unsigned m, double x);
+ float assoc_legendref(unsigned l, unsigned m, float x);
+ long double assoc_legendrel(unsigned l, unsigned m, long double x);
+
+The assoc_legendre functions return:
+
+[equation legendre_1b]
+
+See also __legendre for the full template (header only) version of this function.
+
+ // [5.2.1.3] beta function:
+ double beta(double x, double y);
+ float betaf(float x, float y);
+ long double betal(long double x, long double y);
+
+Returns the beta function of /x/ and /y/:
+
+[equation beta1]
+
+See also __beta for the full template (header only) version of this function.
+
+ // [5.2.1.4] (complete) elliptic integral of the first kind:
+ double comp_ellint_1(double k);
+ float comp_ellint_1f(float k);
+ long double comp_ellint_1l(long double k);
+
+Returns the complete elliptic integral of the first kind of /k/:
+
+[equation ellint6]
+
+See also __ellint_1 for the full template (header only) version of this function.
+
+ // [5.2.1.5] (complete) elliptic integral of the second kind:
+ double comp_ellint_2(double k);
+ float comp_ellint_2f(float k);
+ long double comp_ellint_2l(long double k);
+
+Returns the complete elliptic integral of the second kind of /k/:
+
+[equation ellint7]
+
+See also __ellint_2 for the full template (header only) version of this function.
+
+ // [5.2.1.6] (complete) elliptic integral of the third kind:
+ double comp_ellint_3(double k, double nu);
+ float comp_ellint_3f(float k, float nu);
+ long double comp_ellint_3l(long double k, long double nu);
+
+Returns the complete elliptic integral of the third kind of /k/ and /nu/:
+
+[equation ellint8]
+
+See also __ellint_3 for the full template (header only) version of this function.
+
+ // [5.2.1.8] regular modified cylindrical Bessel functions:
+ double cyl_bessel_i(double nu, double x);
+ float cyl_bessel_if(float nu, float x);
+ long double cyl_bessel_il(long double nu, long double x);
+
+Returns the modified bessel function of the first kind of /nu/ and /x/:
+
+[equation mbessel2]
+
+See also __cyl_bessel_i for the full template (header only) version of this function.
+
+ // [5.2.1.9] cylindrical Bessel functions (of the first kind):
+ double cyl_bessel_j(double nu, double x);
+ float cyl_bessel_jf(float nu, float x);
+ long double cyl_bessel_jl(long double nu, long double x);
+
+Returns the bessel function of the first kind of /nu/ and /x/:
+
+[equation bessel2]
+
+See also __cyl_bessel_j for the full template (header only) version of this function.
+
+ // [5.2.1.10] irregular modified cylindrical Bessel functions:
+ double cyl_bessel_k(double nu, double x);
+ float cyl_bessel_kf(float nu, float x);
+ long double cyl_bessel_kl(long double nu, long double x);
+
+Returns the modified bessel function of the second kind of /nu/ and /x/:
+
+[equation mbessel3]
+
+See also __cyl_bessel_k for the full template (header only) version of this function.
+
+ // [5.2.1.11] cylindrical Neumann functions;
+ // cylindrical Bessel functions (of the second kind):
+ double cyl_neumann(double nu, double x);
+ float cyl_neumannf(float nu, float x);
+ long double cyl_neumannl(long double nu, long double x);
+
+Returns the bessel function of the second kind (Neumann function) of /nu/ and /x/:
+
+[equation bessel3]
+
+See also __cyl_neumann for the full template (header only) version of this function.
+
+ // [5.2.1.12] (incomplete) elliptic integral of the first kind:
+ double ellint_1(double k, double phi);
+ float ellint_1f(float k, float phi);
+ long double ellint_1l(long double k, long double phi);
+
+Returns the incomplete elliptic integral of the first kind of /k/ and /phi/:
+
+[equation ellint2]
+
+See also __ellint_1 for the full template (header only) version of this function.
+
+ // [5.2.1.13] (incomplete) elliptic integral of the second kind:
+ double ellint_2(double k, double phi);
+ float ellint_2f(float k, float phi);
+ long double ellint_2l(long double k, long double phi);
+
+Returns the incomplete elliptic integral of the second kind of /k/ and /phi/:
+
+[equation ellint3]
+
+See also __ellint_2 for the full template (header only) version of this function.
+
+ // [5.2.1.14] (incomplete) elliptic integral of the third kind:
+ double ellint_3(double k, double nu, double phi);
+ float ellint_3f(float k, float nu, float phi);
+ long double ellint_3l(long double k, long double nu, long double phi);
+
+Returns the incomplete elliptic integral of the third kind of /k/, /nu/ and /phi/:
+
+[equation ellint4]
+
+See also __ellint_3 for the full template (header only) version of this function.
+
+ // [5.2.1.15] exponential integral:
+ double expint(double x);
+ float expintf(float x);
+ long double expintl(long double x);
+
+Returns the exponential integral Ei of /x/:
+
+[equation expint_i_1]
+
+See also __expint for the full template (header only) version of this function.
+
+ // [5.2.1.16] Hermite polynomials:
+ double hermite(unsigned n, double x);
+ float hermitef(unsigned n, float x);
+ long double hermitel(unsigned n, long double x);
+
+Returns the n'th Hermite polynomial of /x/:
+
+[equation hermite_0]
+
+See also __hermite for the full template (header only) version of this function.
+
+ // [5.2.1.18] Laguerre polynomials:
+ double laguerre(unsigned n, double x);
+ float laguerref(unsigned n, float x);
+ long double laguerrel(unsigned n, long double x);
+
+Returns the n'th Laguerre polynomial of /x/:
+
+[equation laguerre_0]
+
+See also __laguerre for the full template (header only) version of this function.
+
+ // [5.2.1.19] Legendre polynomials:
+ double legendre(unsigned l, double x);
+ float legendref(unsigned l, float x);
+ long double legendrel(unsigned l, long double x);
+
+Returns the l'th Legendre polynomial of /x/:
+
+[equation legendre_0]
+
+See also __legendre for the full template (header only) version of this function.
+
+ // [5.2.1.20] Riemann zeta function:
+ double riemann_zeta(double);
+ float riemann_zetaf(float);
+ long double riemann_zetal(long double);
+
+Returns the Riemann Zeta function of /x/:
+
+[equation zeta1]
+
+See also __zeta for the full template (header only) version of this function.
+
+ // [5.2.1.21] spherical Bessel functions (of the first kind):
+ double sph_bessel(unsigned n, double x);
+ float sph_besself(unsigned n, float x);
+ long double sph_bessell(unsigned n, long double x);
+
+Returns the spherical Bessel function of the first kind of /x/ j[sub n](x):
+
+[equation sbessel2]
+
+See also __sph_bessel for the full template (header only) version of this function.
+
+ // [5.2.1.22] spherical associated Legendre functions:
+ double sph_legendre(unsigned l, unsigned m, double theta);
+ float sph_legendref(unsigned l, unsigned m, float theta);
+ long double sph_legendrel(unsigned l, unsigned m, long double theta);
+
+Returns the spherical associated Legendre function of /l/, /m/ and /theta/:
+
+[equation spherical_3]
+
+See also __spherical_harmonic for the full template (header only) version of this function.
+
+ // [5.2.1.23] spherical Neumann functions;
+ // spherical Bessel functions (of the second kind):
+ double sph_neumann(unsigned n, double x);
+ float sph_neumannf(unsigned n, float x);
+ long double sph_neumannl(unsigned n, long double x);
+
+Returns the spherical Neumann function of /x/ y[sub n](x):
+
+[equation sbessel2]
+
+See also __sph_bessel for the full template (header only) version of this function.
+
+
+
+[h4 Currently Unsupported TR1 Functions]
+
+ // [5.2.1.7] confluent hypergeometric functions:
+ double conf_hyperg(double a, double c, double x);
+ float conf_hypergf(float a, float c, float x);
+ long double conf_hypergl(long double a, long double c, long double x);
+
+ // [5.2.1.17] hypergeometric functions:
+ double hyperg(double a, double b, double c, double x);
+ float hypergf(float a, float b, float c, float x);
+ long double hypergl(long double a, long double b, long double c,
+ long double x);
+
+[note Thes two functions are not implemented as they are not believed
+to be numerically stable.]
+
+
+[endsect]
+
+[/
+ Copyright 2008 John Maddock and Paul A. Bristow.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+
Modified: sandbox/math_toolkit/libs/math/src/tr1/assoc_legendre.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/src/tr1/assoc_legendre.cpp (original)
+++ sandbox/math_toolkit/libs/math/src/tr1/assoc_legendre.cpp 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -10,5 +10,5 @@
extern "C" double BOOST_MATH_TR1_DECL assoc_legendre(unsigned l, unsigned m, double x)
{
- return c_policies::legendre_p(l, m, x);
+ return (m&1 ? -1 : 1) * c_policies::legendre_p(l, m, x);
}
Modified: sandbox/math_toolkit/libs/math/src/tr1/assoc_legendref.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/src/tr1/assoc_legendref.cpp (original)
+++ sandbox/math_toolkit/libs/math/src/tr1/assoc_legendref.cpp 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -10,5 +10,5 @@
extern "C" float BOOST_MATH_TR1_DECL assoc_legendref(unsigned l, unsigned m, float x)
{
- return c_policies::legendre_p(l, m, x);
+ return (m&1 ? -1 : 1) * c_policies::legendre_p(l, m, x);
}
Modified: sandbox/math_toolkit/libs/math/src/tr1/assoc_legendrel.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/src/tr1/assoc_legendrel.cpp (original)
+++ sandbox/math_toolkit/libs/math/src/tr1/assoc_legendrel.cpp 2008-05-12 12:39:25 EDT (Mon, 12 May 2008)
@@ -10,5 +10,5 @@
extern "C" long double BOOST_MATH_TR1_DECL assoc_legendrel(unsigned l, unsigned m, long double x)
{
- return c_policies::legendre_p(l, m, x);
+ return (m&1 ? -1 : 1) * c_policies::legendre_p(l, m, x);
}
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