# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

## Boost.Math

The following libraries are present in Boost.Math:

Library

Description

Complex Number Inverse Trigonometric Functions

These complex number algorithms are the inverses of trigonometric functions currently present in the C++ standard. Equivalents to these functions are part of the C99 standard, and are part of the Technical Report on C++ Library Extensions.

Greatest Common Divisor and Least Common Multiple

The class and function templates in <boost/math/common_factor.hpp> provide run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM) of two integers. These facilities are useful for many numeric-oriented generic programming problems.

Octonions

Octonions, like quaternions, are a relative of complex numbers.

Octonions see some use in theoretical physics.

In practical terms, an octonion is simply an octuple of real numbers (α,β,γ,δ,ε,ζ,η,θ), which we can write in the form `o = α + βi + γj + δk + εe' + ζi' + ηj' + θk'`, where `i`, `j` and `k` are the same objects as for quaternions, and `e'`, `i'`, `j'` and `k'` are distinct objects which play essentially the same kind of role as `i` (or `j` or `k`).

Addition and a multiplication is defined on the set of octonions, which generalize their quaternionic counterparts. The main novelty this time is that the multiplication is not only not commutative, is now not even associative (i.e. there are quaternions `x`, `y` and `z` such that ```x(yz) ≠ (xy)z```). A way of remembering things is by using the following multiplication table: Octonions (and their kin) are described in far more details in this other document (with errata and addenda).

Some traditional constructs, such as the exponential, carry over without too much change into the realms of octonions, but other, such as taking a square root, do not (the fact that the exponential has a closed form is a result of the author, but the fact that the exponential exists at all for octonions is known since quite a long time ago).

Special Functions

Provides a number of high quality special functions, initially these were concentrated on functions used in statistical applications along with those in the Technical Report on C++ Library Extensions.

The function families currently implemented are the gamma, beta & erf functions along with the incomplete gamma and beta functions (four variants of each) and all the possible inverses of these, plus digamma, various factorial functions, Bessel functions, elliptic integrals, sinus cardinals (along with their hyperbolic variants), inverse hyperbolic functions, Legrendre/Laguerre/Hermite polynomials and various special power and logarithmic functions.

All the implementations are fully generic and support the use of arbitrary "real-number" types, although they are optimised for use with types with known-about significand (or mantissa) sizes: typically float, double or long double.

Statistical Distributions

Provides a reasonably comprehensive set of statistical distributions, upon which higher level statistical tests can be built.

The initial focus is on the central univariate distributions. Both continuous (like normal & Fisher) and discrete (like binomial & Poisson) distributions are provided.

A comprehensive tutorial is provided, along with a series of worked examples illustrating how the library is used to conduct statistical tests.

Quaternions

Quaternions are a relative of complex numbers.

Quaternions are in fact part of a small hierarchy of structures built upon the real numbers, which comprise only the set of real numbers (traditionally named R), the set of complex numbers (traditionally named C), the set of quaternions (traditionally named H) and the set of octonions (traditionally named O), which possess interesting mathematical properties (chief among which is the fact that they are division algebras, i.e. where the following property is true: if `y` is an element of that algebra and is not equal to zero, then ```yx = yx'```, where `x` and `x'` denote elements of that algebra, implies that `x = x'`). Each member of the hierarchy is a super-set of the former.

One of the most important aspects of quaternions is that they provide an efficient way to parameterize rotations in R3 (the usual three-dimensional space) and R4.

In practical terms, a quaternion is simply a quadruple of real numbers (α,β,γ,δ), which we can write in the form `q = α + βi + γj + δk`, where `i` is the same object as for complex numbers, and `j` and `k` are distinct objects which play essentially the same kind of role as `i`.

An addition and a multiplication is defined on the set of quaternions, which generalize their real and complex counterparts. The main novelty here is that the multiplication is not commutative (i.e. there are quaternions `x` and `y` such that ```xy ≠ yx```). A good mnemotechnical way of remembering things is by using the formula ```i*i = j*j = k*k = -1```.

Quaternions (and their kin) are described in far more details in this other document (with errata and addenda).

Some traditional constructs, such as the exponential, carry over without too much change into the realms of quaternions, but other, such as taking a square root, do not.

The following Boost libraries are also mathematically oriented:

Library

Description

Headers to ease dealing with integral types.

As implied by its name, this library is intended to help manipulating mathematical intervals. It consists of a single header <boost/numeric/interval.hpp> and principally a type which can be used as interval<T>.

Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface.

The Boost Numeric Conversion library is a collection of tools to describe and perform conversions between values of different numeric types.

The header <boost/operators.hpp> supplies several sets of class templates (in namespace boost). These templates define operators at namespace scope in terms of a minimal number of fundamental operators provided by the class.

Random numbers are useful in a variety of applications. The Boost Random Number Library (Boost.Random for short) provides a vast variety of generators and distributions to produce random numbers having useful properties, such as uniform distribution.

The header rational.hpp provides an implementation of rational numbers. The implementation is template-based, in a similar manner to the standard complex number class.

uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via operator overloading and efficient code generation via expression templates.

 Last revised: September 01, 2010 at 19:10:43 +0100