Feel++ 0.91.0

Solving Linear Algebra Problems

Feel supports three different linear algebra environments that we shall call Backend .

Choosing a linear algebra backend

To select a backend in order to solve a linear system, we instantiate the Backend class associated.

#include <feel/feelalg/backend.hpp>
boost::shared_ptr<Backend<double> > backend =
     Backend<double>::build( BACKEND_PETSC );

The backend provides an interface to solve

\[ A x = b \]

where $A$ is a $n \times n $ sparse matrix and $x,b$ vectors of size $n$. The backend defines the types for each of these, e.g.

Backend<double>::sparse_matrix_type A;
Backend<double>::vector_type x,b;

In practice, we use the boost::shared_ptr<> shared pointer to ensure that we won't get memory leaks. The backends provide a corresponding typedef

Backend<double>::sparse_matrix_ptrtype A( backend->newMatrix( Xh, Yh ) );
Backend<double>::vector_ptrtype x( backend->newVector( Yh ) );
Backend<double>::vector_ptrtype b( backend->newVector( Xh ) );

where $X_h$ and $Y_h$ are function spaces providing the number of degrees of freedom that will define the size of the matrix and vectors thanks to the helpers functions Backend::newMatrix() and Backend::newVector. In a parallel setting, the local/global processor mapping would be passed down by the function spaces.

Defining and using matrices and vectors

Solving