12.07.2015 Views

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wellsuint M = 100;uint N = 100;Matrix A(M,N);Similarly, the vector class Vector allows for a simple initialization of a Mvector:Vector b(M);Further, wrappers for some basic linear algebra functionality, such as matrixvector multiplication, norms etc., are provided with an intentionally simpleinterface, for example, matrix vector multiplication is defined by:Vector Ax;A.mult(b,Ax);For more advanced operations, a pointer to the PETSc matrix and vector isaccessed by mat() and vec() respectively.3.2 Matrix-free matricesThe <strong>DOLFIN</strong> class VirtualMatrix represents a matrix-free matrix of dimensionM × M. The matrix-free matrix is a simple wrapper for a PETScshell matrix. The interface is intentionally simple, and for advanced usagethe PETSc Mat pointer is accessed by the function mat().The class VirtualMatrix enables the use of Krylov subspace methods forlinear systems Ax = b, without having to explicitly store the matrix A. Allthat is needed is that the user-defined VirtualMatrix implements multiplicationwith vectors. Note that the multiplication operator needs to bedefined in terms of PETSc data structures (Vec), since it will be called fromPETSc.26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!