C++ for Scientists - Technische Universität Dresden
C++ for Scientists - Technische Universität Dresden
C++ for Scientists - Technische Universität Dresden
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
11.3. BOOST.BINDINGS 245<br />
• Math and numerics<br />
– numeric::conversions: conversions of types<br />
– thread: multi-threading<br />
– bindings: generic bindings to external software<br />
– graph: graph programs<br />
– integer: integer types<br />
– interval: interval arithmetic<br />
– random: random number generator<br />
– rational: rational numbers<br />
– math: various mathematical things, e.g. greatest common divisor<br />
– typeof: type deduction<br />
– numeric::ublas: vector and matrix library<br />
– math::quaternion, math::octonian<br />
– math::special functions<br />
• Miscellaneous<br />
– filesystem: advanced operations on files, directories<br />
– program options: working with command line options in your<br />
– timer: timing class<br />
For more in<strong>for</strong>mation on these and other boost libraries see http://www.boost.org.<br />
11.3 Boost.Bindings<br />
Scientific programmers using <strong>C++</strong> also want to use the features offered by mature FORTRAN<br />
and C codes such as LAPACK [?], MUMPS [?] [?], SuperLU [?] and UMFPACK [?]. The<br />
programming ef<strong>for</strong>t <strong>for</strong> rewriting these codes in <strong>C++</strong> is very high. It there<strong>for</strong>e makes more<br />
sense to link the codes into <strong>C++</strong> code. Another argument <strong>for</strong> linking with external software is<br />
per<strong>for</strong>mance : the vendor tuned BLAS functions are perhaps the most obvious example.<br />
In the traditional approach, an interface is developed <strong>for</strong> each basic <strong>C++</strong> linear algebra package<br />
and <strong>for</strong> each external linear algebra package. This is illustrated by Figure 11.1. The Boost<br />
bindings adopt the approach of orthogonality between algorithms and data. This orthogonality<br />
is created by traits classes that provide the necessary data to the external software. The vector<br />
traits, <strong>for</strong> example, provide a pointer (or address), size and stride, which can then be used<br />
by e.g. the BLAS function ddot. Each traits class is specialized <strong>for</strong> user defined vector and<br />
matrix packages. This implies that, <strong>for</strong> a new vector or matrix type, the development ef<strong>for</strong>t is<br />
limited to the specialization of the traits classes. Once the traits classes are specialized, BLAS<br />
and LAPACK can be used straightaway. For a new external software package, it is sufficient