Friday 27 July 2012

Boost Math Basics

Understanding Boost Math is about a) understanding the underlying mathematical concepts, but additionally you have to understand b) what the typenames mean.

Quick revision guide on typenames in C++: They are used to disambiguate type declarations, but have a dual role in that they can be used in place of class in template parameter declarations.

Math typenames from Boost:
1. RealType - denotes a real number, usually represented/approximated by, a double.
2. Policy - transmits behaviour, e.g. what to do when certain error conditions are met. An example in STL of a policy class would be std::allocator which communicates memory management policy to container classes.

You also need to understand error functions, mathematically denoted by erf(z) and erfc(z)=1-erf(z). erfz is e to the minus t squared integrated between 0 to z and "normalized" by two divided by the square root of pi.

The error function (also known as the "Gauss error function") is one of the "special functions" in mathematics. It has a sigmoid (or "S") shape.

You will see also that Boost header files have a .hpp extension rather than .h (which signifies pure C++). .h files are also used in C.

No comments: