firedrake.slate package¶
Submodules¶
firedrake.slate.slate module¶
Slate is a symbolic language defining a framework for performing linear algebra operations on finite element tensors. It is similar in principle to most linear algebra libraries in notation.
The design of Slate was heavily influenced by UFL, and utilizes much of UFL’s functionality for FEMspecific form manipulation.
Unlike UFL, however, once forms are assembled into Slate Tensor objects, one can utilize the operations defined in Slate to express complicated linear algebra operations (such as the Schurcomplement reduction of a blockmatrix system).
All Slate expressions are handled by a specialized linear algebra compiler, which interprets expressions and produces C++ kernel functions to be executed within the Firedrake architecture.

class
firedrake.slate.slate.
AssembledVector
[source]¶ Bases:
firedrake.slate.slate.TensorBase
This class is a symbolic representation of an assembled vector of data contained in a
firedrake.Function
. Parameters
function – A firedrake function.

property
integrals
¶

operands
= ()¶

prec
= 0¶

class
firedrake.slate.slate.
Block
(tensor, indices)[source]¶ Bases:
firedrake.slate.slate.TensorBase
This class represents a tensor corresponding to particular block of a mixed tensor. Depending on the indices provided, the subblocks can span multiple test/trial spaces.
 Parameters
tensor – A (mixed) tensor.
indices – Indices of the test and trial function spaces to extract. This should be a 0, 1, or 2tuple (whose length is equal to the rank of the tensor.) The entries should be an iterable of integer indices.
For example, consider the mixed tensor defined by:
n = FacetNormal(m) U = FunctionSpace(m, "DRT", 1) V = FunctionSpace(m, "DG", 0) M = FunctionSpace(m, "DGT", 0) W = U * V * M u, p, r = TrialFunctions(W) w, q, s = TestFunctions(W) A = Tensor(dot(u, w)*dx + p*div(w)*dx + r*dot(w, n)*dS + div(u)*q*dx + p*q*dx + r*s*ds)
This describes a block 3x3 mixed tensor of the form:
\[\begin{bmatrix} A & B & C \ D & E & F \ G & H & J \end{bmatrix}\]Providing the 2tuple ((0, 1), (0, 1)) returns a tensor corresponding to the upper 2x2 block:
\[\begin{bmatrix} A & B \ D & E \end{bmatrix}\]More generally, argument indices of the form (idr, idc) produces a tensor of blocksize len(idr) x len(idc) spanning the specified test/trial spaces.
Constructor for the Block class.

prec
= 0¶

class
firedrake.slate.slate.
Factorization
(tensor, decomposition=None)[source]¶ Bases:
firedrake.slate.slate.TensorBase
An abstract Slate class for the factorization of matrices. The factorizations available are the following:
LU with full or partial pivoting (‘FullPivLU’ and ‘PartialPivLU’);
QR using Householder reflectors (‘HouseholderQR’) with the option to use column pivoting (‘ColPivHouseholderQR’) or full pivoting (‘FullPivHouseholderQR’);
standard Cholesky (‘LLT’) and stabilized Cholesky factorizations with pivoting (‘LDLT’);
a rankrevealing complete orthogonal decomposition using Householder transformations (‘CompleteOrthogonalDecomposition’); and
singularvalued decompositions (‘JacobiSVD’ and ‘BDCSVD’). For larger matrices, ‘BDCSVD’ is recommended.
Constructor for the Factorization class.

prec
= 0¶

class
firedrake.slate.slate.
Tensor
(form)[source]¶ Bases:
firedrake.slate.slate.TensorBase
This class is a symbolic representation of a finite element tensor derived from a bilinear or linear form. This class implements all supported ranks of general tensor (rank0, rank1 and rank2 tensor objects). This class is the primary userfacing class that the Slate symbolic algebra supports.
 Parameters
form – a
ufl.Form
object.
A
ufl.Form
is currently the only supported input of creating a slate.Tensor object:If the form is a bilinear form, namely a form with two
ufl.Argument
objects, then the Slate Tensor will be a rank2 Matrix.If the form has one ufl.Argument as in the case of a typical linear form, then this will create a rank1 Vector.
A zeroform will create a rank0 Scalar.
These are all under the same type slate.Tensor. The attribute self.rank is used to determine what kind of tensor object is being handled.
Constructor for the Tensor class.

operands
= ()¶

prec
= 0¶

class
firedrake.slate.slate.
Inverse
(A)[source]¶ Bases:
firedrake.slate.slate.UnaryOp
An abstract Slate class representing the inverse of a tensor.
Warning
This class will raise an error if the tensor is not square.
Constructor for the Inverse class.

class
firedrake.slate.slate.
Transpose
(*operands)[source]¶ Bases:
firedrake.slate.slate.UnaryOp
An abstract Slate class representing the transpose of a tensor.
Constructor for the TensorOp class.

class
firedrake.slate.slate.
Negative
(*operands)[source]¶ Bases:
firedrake.slate.slate.UnaryOp
Abstract Slate class representing the negation of a tensor object.
Constructor for the TensorOp class.

class
firedrake.slate.slate.
Add
(A, B)[source]¶ Bases:
firedrake.slate.slate.BinaryOp
 Abstract Slate class representing matrixmatrix, vectorvector
or scalarscalar addition.
 Parameters
A – a
TensorBase
object.B – another
TensorBase
object.
Constructor for the Add class.

prec
= 1¶

class
firedrake.slate.slate.
Mul
(A, B)[source]¶ Bases:
firedrake.slate.slate.BinaryOp
Abstract Slate class representing the interior product or two tensors. By interior product, we mean an operation that results in a tensor of equal or lower rank via performing a contraction on arguments. This includes MatrixMatrix and MatrixVector multiplication.
 Parameters
A – a
TensorBase
object.B – another
TensorBase
object.
Constructor for the Mul class.

arguments
()[source]¶ Returns the arguments of a tensor resulting from multiplying two tensors A and B.

prec
= 2¶

class
firedrake.slate.slate.
Solve
(A, B, decomposition=None)[source]¶ Bases:
firedrake.slate.slate.BinaryOp
Abstract Slate class describing a local linear system of equations. This object is a direct solver, utilizing the application of the inverse of matrix in a decomposed form.
 Parameters
A – The lefthand side operator.
B – The righthand side.
decomposition – A string denoting the type of matrix decomposition to used. The factorizations available are detailed in the
Factorization
documentation.
Constructor for the Solve class.

arguments
()[source]¶ Returns the arguments of a tensor resulting from applying the inverse of A onto B.

prec
= 2¶