From e0737c56c1e384e05064a0c6e1ac46979371041b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 19 Dec 2018 22:58:32 +0100 Subject: New upstream version 2.0.0+repack --- .../html/math_toolkit/factorials/sf_binomial.html | 145 ++++++++++++++++ .../factorials/sf_double_factorial.html | 161 +++++++++++++++++ .../html/math_toolkit/factorials/sf_factorial.html | 193 +++++++++++++++++++++ .../factorials/sf_falling_factorial.html | 110 ++++++++++++ .../factorials/sf_rising_factorial.html | 114 ++++++++++++ 5 files changed, 723 insertions(+) create mode 100644 boost/libs/math/doc/html/math_toolkit/factorials/sf_binomial.html create mode 100644 boost/libs/math/doc/html/math_toolkit/factorials/sf_double_factorial.html create mode 100644 boost/libs/math/doc/html/math_toolkit/factorials/sf_factorial.html create mode 100644 boost/libs/math/doc/html/math_toolkit/factorials/sf_falling_factorial.html create mode 100644 boost/libs/math/doc/html/math_toolkit/factorials/sf_rising_factorial.html (limited to 'boost/libs/math/doc/html/math_toolkit/factorials') diff --git a/boost/libs/math/doc/html/math_toolkit/factorials/sf_binomial.html b/boost/libs/math/doc/html/math_toolkit/factorials/sf_binomial.html new file mode 100644 index 00000000..4c03acdc --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/factorials/sf_binomial.html @@ -0,0 +1,145 @@ + + + +Binomial Coefficients + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
#include <boost/math/special_functions/binomial.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+T binomial_coefficient(unsigned n, unsigned k);
+
+template <class T, class Policy>
+T binomial_coefficient(unsigned n, unsigned k, const Policy&);
+
+}} // namespaces
+
+

+ Returns the binomial coefficient: nCk. +

+

+ Requires k <= n. +

+

+ The final Policy argument is optional and can + be used to control the behaviour of the function: how it handles errors, + what level of precision to use etc. Refer to the policy + documentation for more details. +

+

+ May return the result of overflow_error + if the result is too large to represent in type T. +

+
+ + + + + +
[Important]Important
+

+ The functions described above are templates where the template argument + T can not be deduced from the arguments passed to the function. Therefore + if you write something like: +

+

+ boost::math::binomial_coefficient(10, 2); +

+

+ You will get a compiler error, ususally indicating that there is no such + function to be found. Instead you need to specifiy the return type explicity + and write: +

+

+ boost::math::binomial_coefficient<double>(10, 2); +

+

+ So that the return type is known. Further, the template argument must be + a real-valued type such as float + or double and not an integer + type - that would overflow far too easily! +

+
+
+ + Accuracy +
+

+ The accuracy will be the same as for the factorials for small arguments (i.e. + no more than one or two epsilon), and the beta + function for larger arguments. +

+
+ + Testing +
+

+ The spot tests for the binomial coefficients use data generated by functions.wolfram.com. +

+
+ + Implementation +
+

+ Binomial coefficients are calculated using table lookup of factorials where + possible using: +

+

+ nCk = n! / (k!(n-k)!) +

+

+ Otherwise it is implemented in terms of the beta function using the relations: +

+

+ nCk = 1 / (k * beta(k, + n-k+1)) +

+

+ and +

+

+ nCk = 1 / ((n-k) * beta(k+1, + n-k)) +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/factorials/sf_double_factorial.html b/boost/libs/math/doc/html/math_toolkit/factorials/sf_double_factorial.html new file mode 100644 index 00000000..da12c54b --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/factorials/sf_double_factorial.html @@ -0,0 +1,161 @@ + + + +Double Factorial + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
#include <boost/math/special_functions/factorials.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+T double_factorial(unsigned i);
+
+template <class T, class Policy>
+T double_factorial(unsigned i, const Policy&);
+
+}} // namespaces
+
+

+ Returns i!!. +

+

+ The final Policy argument is optional and can + be used to control the behaviour of the function: how it handles errors, + what level of precision to use etc. Refer to the policy + documentation for more details. +

+

+ May return the result of overflow_error + if the result is too large to represent in type T. The implementation is + designed to be optimised for small i where table lookup + of i! is possible. +

+
+ + + + + +
[Important]Important
+

+ The functions described above are templates where the template argument + T can not be deduced from the arguments passed to the function. Therefore + if you write something like: +

+

+ boost::math::double_factorial(2); +

+

+ You will get a (possibly perplexing) compiler error, ususally indicating + that there is no such function to be found. Instead you need to specifiy + the return type explicity and write: +

+

+ boost::math::double_factorial<double>(2); +

+

+ So that the return type is known. Further, the template argument must be + a real-valued type such as float + or double and not an integer + type - that would overflow far too easily! +

+

+ The source code static_assert + and comment just after the will be: +

+
BOOST_STATIC_ASSERT(!boost::is_integral<T>::value);
+// factorial<unsigned int>(n) is not implemented
+// because it would overflow integral type T for too small n
+// to be useful. Use instead a floating-point type,
+// and convert to an unsigned type if essential, for example:
+// unsigned int nfac = static_cast<unsigned int>(factorial<double>(n));
+// See factorial documentation for more detail.
+
+
+
+ + + + + +
[Note]Note

+ The argument to double_factorial + is type unsigned even though + technically -1!! is defined. +

+
+ + Accuracy +
+

+ The implementation uses a trivial adaptation of the factorial function, so + error rates should be no more than a couple of epsilon higher. +

+
+ + Testing +
+

+ The spot tests for the double factorial use data generated by functions.wolfram.com. +

+
+ + Implementation +
+

+ The double factorial is implemented in terms of the factorial and gamma functions + using the relations: +

+

+ (2n)!! = 2n * n! +

+

+ (2n+1)!! = (2n+1)! / (2n n!) +

+

+ and +

+

+ (2n-1)!! = Γ((2n+1)/2) * 2n / sqrt(pi) +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/factorials/sf_factorial.html b/boost/libs/math/doc/html/math_toolkit/factorials/sf_factorial.html new file mode 100644 index 00000000..37bd26ff --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/factorials/sf_factorial.html @@ -0,0 +1,193 @@ + + + +Factorial + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
+ + Synopsis +
+
#include <boost/math/special_functions/factorials.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+T factorial(unsigned i);
+
+template <class T, class Policy>
+T factorial(unsigned i, const Policy&);
+
+template <class T>
+T unchecked_factorial(unsigned i);
+
+template <class T>
+struct max_factorial;
+
+}} // namespaces
+
+
+ + Description +
+
+ + + + + +
[Important]Important
+

+ The functions described below are templates where the template argument + T CANNOT be deduced from the arguments passed to the function. Therefore + if you write something like: +

+

+ boost::math::factorial(2); +

+

+ You will get a (perhaps perplexing) compiler error, ususally indicating + that there is no such function to be found. Instead you need to specify + the return type explicity and write: +

+

+ boost::math::factorial<double>(2); +

+

+ So that the return type is known. +

+

+ Furthermore, the template argument must be a real-valued type such as + float or double + and not an integer type - that would overflow far too easily for quite + small values of parameter i! +

+

+ The source code static_assert + and comment just after the will be: +

+
BOOST_STATIC_ASSERT(!boost::is_integral<T>::value);
+// factorial<unsigned int>(n) is not implemented
+// because it would overflow integral type T for too small n
+// to be useful. Use instead a floating-point type,
+// and convert to an unsigned type if essential, for example:
+// unsigned int nfac = static_cast<unsigned int>(factorial<double>(n));
+// See factorial documentation for more detail.
+
+
+
template <class T>
+T factorial(unsigned i);
+
+template <class T, class Policy>
+T factorial(unsigned i, const Policy&);
+
+

+ Returns i!. +

+

+ The final Policy argument is optional and can + be used to control the behaviour of the function: how it handles errors, + what level of precision to use etc. Refer to the policy + documentation for more details. +

+

+ For i <= max_factorial<T>::value this is implemented + by table lookup, for larger values of i, this function + is implemented in terms of tgamma. +

+

+ If i is so large that the result can not be represented + in type T, then calls overflow_error. +

+
template <class T>
+T unchecked_factorial(unsigned i);
+
+

+ Returns i!. +

+

+ Internally this function performs table lookup of the result. Further it + performs no range checking on the value of i: it is up to the caller to ensure + that i <= max_factorial<T>::value. This function + is intended to be used inside inner loops that require fast table lookup + of factorials, but requires care to ensure that argument i + never grows too large. +

+
template <class T>
+struct max_factorial
+{
+   static const unsigned value = X;
+};
+
+

+ This traits class defines the largest value that can be passed to unchecked_factorial. + The member value can be used + where integral constant expressions are required: for example to define the + size of further tables that depend on the factorials. +

+
+ + Accuracy +
+

+ For arguments smaller than max_factorial<T>::value the result should be correctly rounded. + For larger arguments the accuracy will be the same as for tgamma. +

+
+ + Testing +
+

+ Basic sanity checks and spot values to verify the data tables: the main tests + for the tgamma function + handle those cases already. +

+
+ + Implementation +
+

+ The factorial function is table driven for small arguments, and is implemented + in terms of tgamma for + larger arguments. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/factorials/sf_falling_factorial.html b/boost/libs/math/doc/html/math_toolkit/factorials/sf_falling_factorial.html new file mode 100644 index 00000000..b9f8d67e --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/factorials/sf_falling_factorial.html @@ -0,0 +1,110 @@ + + + +Falling Factorial + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
#include <boost/math/special_functions/factorials.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type falling_factorial(T x, unsigned i);
+
+template <class T, class Policy>
+calculated-result-type falling_factorial(T x, unsigned i, const Policy&);
+
+}} // namespaces
+
+

+ Returns the falling factorial of x and i: +

+

+ falling_factorial(x, i) = x(x-1)(x-2)(x-3)...(x-i+1) +

+

+ Note that this function is only defined for positive i, + hence the unsigned second argument. + Argument x can be either positive or negative however. +

+

+ The final Policy argument is optional and can + be used to control the behaviour of the function: how it handles errors, + what level of precision to use etc. Refer to the policy + documentation for more details. +

+

+ May return the result of overflow_error + if the result is too large to represent in type T. +

+

+ The return type of these functions is computed using the result + type calculation rules: the type of the result is double if T is an integer type, otherwise + the type of the result is T. +

+
+ + Accuracy +
+

+ The accuracy will be the same as the tgamma_delta_ratio + function. +

+
+ + Testing +
+

+ The spot tests for the falling factorials use data generated by functions.wolfram.com. +

+
+ + Implementation +
+

+ Rising and falling factorials are implemented as ratios of gamma functions + using tgamma_delta_ratio. + Optimisations for small integer arguments are handled internally by that + function. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/factorials/sf_rising_factorial.html b/boost/libs/math/doc/html/math_toolkit/factorials/sf_rising_factorial.html new file mode 100644 index 00000000..a98c40d9 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/factorials/sf_rising_factorial.html @@ -0,0 +1,114 @@ + + + +Rising Factorial + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
#include <boost/math/special_functions/factorials.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type rising_factorial(T x, int i);
+
+template <class T, class Policy>
+calculated-result-type rising_factorial(T x, int i, const Policy&);
+
+}} // namespaces
+
+

+ Returns the rising factorial of x and i: +

+

+ rising_factorial(x, i) = Γ(x + i) / Γ(x); +

+

+ or +

+

+ rising_factorial(x, i) = x(x+1)(x+2)(x+3)...(x+i-1) +

+

+ Note that both x and i can be negative + as well as positive. +

+

+ The final Policy argument is optional and can + be used to control the behaviour of the function: how it handles errors, + what level of precision to use etc. Refer to the policy + documentation for more details. +

+

+ May return the result of overflow_error + if the result is too large to represent in type T. +

+

+ The return type of these functions is computed using the result + type calculation rules: the type of the result is double if T is an integer type, otherwise + the type of the result is T. +

+
+ + Accuracy +
+

+ The accuracy will be the same as the tgamma_delta_ratio + function. +

+
+ + Testing +
+

+ The spot tests for the rising factorials use data generated by functions.wolfram.com. +

+
+ + Implementation +
+

+ Rising and falling factorials are implemented as ratios of gamma functions + using tgamma_delta_ratio. + Optimisations for small integer arguments are handled internally by that + function. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + -- cgit v1.2.3