Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Boost Basic Linear Algebra - Configuration Options

NDEBUG

Make sure you define NDEBUG The only way uBLAS knows you want a release configuration is to check if you have defined NDEBUG. If you don't it assumes you want a debug configuration and adds a lot of very useful runtime check. However these are very slow!

BOOST_UBLAS_MOVE_SEMANTICS

The patch and description was provided by Nasos Iliopoulos.

An immediate effect of this option is the elimination of the need for noalias in types vector<T> and matrix<T>, when assigned to the same type. This option doesn't have an effect on bounded and c types. Although it is rare, not all compilers support copy elision (that allows for move semantics), so a test must be performed to make sure that there is a benefit when it is enabled. A small demonstration and test can be found in test_move_semantics.cpp

In the test example two tests are defined, one for vectors and one for matrices. The aim of this example is to print the pointers of the storage of each of the containers, before and after the assignment to a temporary object. When move semantics are enabled, the vector<T> and matrix<T> storage is moved from the temporary and no copy is performed.

If move semantics are supported by your compiler you will get an output like the following:

matrix<double> --------------------------------------------------------------------
Temporary pointer r: 0x94790c0
Pointer (must be equal to temp. pointer if move semantics are enabled) : 0x94790c0

Notes:

Interesting links

BOOST_UBLAS_CHECK_ENABLE

When BOOST_UBLAS_CHECK_ENABLE is defined then all index and parameter checks are enabled. This is enabled in debug mode and disabled in release mode.

BOOST_UBLAS_TYPE_CHECK

When BOOST_UBLAS_TYPE_CHECK is enabled then all possibly expensive structure checks are enabled. If this is not desireable then use #define BOOST_UBLAS_TYPE_CHECK 0 before including any uBLAS header. The define BOOST_UBLAS_TYPE_CHECK_EPSILON can be used to control the acceptable tolerance, see detail/matrix_assign.hpp for implementation details of this check.

BOOST_UBLAS_USE_LONG_DOUBLE

Enable uBLAS expressions that involve containers of 'long double'

BOOST_UBLAS_USE_INTERVAL

Enable uBLAS expressions that involve containers of 'boost::numeric::interval' types

Configuring uBLAS with Macros

Many macro's appear in ublas/config.hpp and elsewhere. Hopefully in the future some of these will disappear! They fall into 4 groups:


Last modified: Wed Sep 16 23:16:45 CEST 2009