PETScMatrix

class dolfin.cpp.la.PETScMatrix(*args)

Bases: dolfin.cpp.la.GenericMatrix, dolfin.cpp.la.PETScBaseMatrix

This class provides a simple matrix class based on PETSc. It is a wrapper for a PETSc matrix pointer (Mat) implementing the GenericMatrix interface.

The interface is intentionally simple. For advanced usage, access the PETSc Mat pointer using the function mat() and use the standard PETSc interface.

Overloaded versions

  • PETScMatrix()

    Create empty matrix (on MPI_COMM_WORLD)

  • PETScMatrix(comm)

    Create empty matrix

  • PETScMatrix(A)

    Create a wrapper around a PETSc Mat pointer. The Mat object should have been created, e.g. via PETSc MatrCreate.

  • PETScMatrix(A)

    Copy constructor

assign()

Overloaded versions

  • operator=(A)

    Assignment operator

  • operator=(A)

    Assignment operator

binary_dump()

Dump matrix to PETSc binary format

get_options_prefix()

Returns the prefix used by PETSc when searching the options database

mpi_comm()

Return MPI communicator

set_from_options()

Call PETSc function MatSetFromOptions on the PETSc Mat object

set_near_nullspace()

Attach near nullspace to matrix (used by preconditioners, such as smoothed aggregation algerbraic multigrid)

set_nullspace()

Attach nullspace to matrix (typically used by Krylov solvers when solving singular systems)

set_options_prefix()

Sets the prefix used by PETSc when searching the options database

thisown

The membership flag

zero()

Overloaded versions

  • zero()

    Set all entries to zero and keep any sparse structure

  • zero(m, rows)

    Set given rows (global row indices) to zero