# firedrake.matrix_free package¶

## firedrake.matrix_free.operators module¶

class firedrake.matrix_free.operators.ImplicitMatrixContext(a, row_bcs=[], col_bcs=[], fc_params=None, appctx=None)[source]

Bases: object

createSubMatrix(mat, row_is, col_is, target=None)[source]
getDiagonal(mat, vec)[source]
getInfo(mat, info=None)[source]
missingDiagonal(mat)[source]
mult(mat, X, Y)[source]
multTranspose(mat, Y, X)[source]

EquationBC makes multTranspose different from mult.

Decompose M^T into bundles of columns associated with the rows of M corresponding to cell, facet, edge, and vertice equations (if exist) and add up their contributions.

Domain

a a a a 0 a a | a a a a 0 a a | a a a a 0 a a | EBC1

M = b b b b b b b | | EBC2 DBC1

0 0 0 0 1 0 0 | | | | c c c c 0 c c | | c c c c 0 c c | |

To avoid copys, use same _y, and update it from left (deepest ebc) to right (least deep ebc or domain)

Multiplication algorithm: _y update -> _y update -> _y

a a a b 0 c c _y0 0 0 0 0 c c c * 0 0 0 b b 0 0 * a a a a a a a _y0 0 a a a b 0 c c _y1 0 0 0 0 c c c * 0 0 0 b b 0 0 * a a a a a a a _y1 0 a a a b 0 c c _y2 0 0 0 0 c c c * 0 0 0 b b 0 0 * a a a a a a a _y2 0

M^T _y = a a a b 0 c c _y3 = 0 0 0 0 c c c * + 0 0 0 b b 0 0 _y3 + a a a a a a a 0 + 0

0 0 0 0 1 0 0 _y4 0 0 0 0 c c c 0 0 0 0 b b 0 0 0 a a a a a a a 0 _y4 (replace at the end) a a a b 0 c c _y5 0 0 0 0 c c c _y5 0 0 0 b b 0 0 * a a a a a a a 0 0 a a a b 0 c c _y6 0 0 0 0 c c c _y6 0 0 0 b b 0 0 * a a a a a a a 0 0

(uniform on (uniform (uniform on domain)

on facet2) on facet1)

• = can be any number

on_diag = True

This class gives the Python context for a PETSc Python matrix.

Parameters
• a – The bilinear form defining the matrix

• row_bcs – An iterable of the :class..DirichletBCs that are imposed on the test space. We distinguish between row and column boundary conditions in the case of submatrices off of the diagonal.

• col_bcs – An iterable of the :class..DirichletBCs that are imposed on the trial space.

• fcparams – A dictionary of parameters to pass on to the form compiler.

• appctx – Any extra user-supplied context, available to preconditioners and the like.

view(mat, viewer=None)[source]