- Find here the online documentation to the library.

While it's possible to use an OO language for your project and link against some FORTRAN code for your numerical routines, it's much nicer to just use just the same language for all you have to do. Being nicer means, that it makes things easier to debug, does not produce cross-platform linker trouble, ... Furthermore, OO languages offer features, you don't want to miss even when doing numerics, such as type abstraction allowing you to use the same routines for real or complex numbers, for normal (full) matrices as well as for several optimized sparse versions. The template mechanism of C++ offers the possibility to let the compiler do lots of work at compile time and have your app perform best possible.

OO languages however have a bad reputation for their performance. The problem is that the straightforward implementation of operators for large dynamically allocated objects such as Vectors or Matrices results in lots of unecessary copying around of data in copy constructors and assignment operators.

With a little more clever approach, this can be avoided. Basically, you can just do a sort of reference counting done at compile time by your compiler. A possible strategy is the *Temporary* Base Class Idiom (TBCI) It has been used in the library, to optimise the speed of Matrix and Vector operations.

More optimizations are possible, such as deferring of operations. This has been implemented for scaling of Vectors and Matrices in this lib. The nice thing about the OO language is that this can be done transparently, without the user of the lib changing a single line of code. He will just notice from the superior performance ...

The lib offers all the standard operators for Vectors, Matrices and a number of optimised sparse matrices and many general purpose routines for the classes involved. Furthermore, it comes with a collection of solvers for linear systems.

Small example:

#include <iostream> #include "tbci/vector.h" #include "tbci/matrix.h" #include "tbci/solver/bicgstab.h" #include "tbci/solver/noprecond.h" int main() { int sz; std::cout << "Demo program, solves M x = y\n"; std::cout << "Enter Vec size: ";; std::cin >> sz; TBCI::Vector<double> x(sz), y(sz); TBCI::Matrix<double> m(sz, sz); std::cout << "Enter Vec y: "; std::cin >> y; std::cout << "Enter Mat M: "; std::cin >> m; double residue = 1e-10; unsigned int maxiter = 100; TBCI::NoPreconditioner<double,TBCI::Matrix<double> > nopc; x.fill(0.0); int conv_solver = TBCI::BiCGSTAB(m, x, y, nopc, maxiter, residue); std::cout << "Solver returned " << conv_solver << " with " << maxiter << " iterations, " << " residue " << residue << std::endl; std::cout << "Result Vec x: " << x << std::endl; std::cout << "Test: M x = " << m*x << std::endl; std::cout << "Test: fabs(M x - y) = " << std::fabs(m*x-y) << std::endl; return 0; }

Generated on Thu Sep 9 00:37:55 2010 for TBCI Numerical high perf. C++ Library by 1.5.6