bempp.api.assembly.discrete_boundary_operator

Data structures for assembled boundary operators.

Module Contents

Classes

_DiscreteOperatorBase

Discrete boundary operator base.

_ScaledDiscreteOperator

Return a scaled operator.

_SumDiscreteOperator

Return a sum operator.

_ProductDiscreteOperator

Product of two operators.

GenericDiscreteBoundaryOperator

Discrete boundary operator that implements a matvec routine.

DenseDiscreteBoundaryOperator

Main class for the discrete form of dense nonlocal operators.

DiagonalOperator

Main class for discrete diagonal operators.

SparseDiscreteBoundaryOperator

Main class for the discrete form of sparse operators.

InverseSparseDiscreteBoundaryOperator

Apply the (pseudo-)inverse of a sparse operator.

ZeroDiscreteBoundaryOperator

A discrete operator that represents a zero operator.

DiscreteRankOneOperator

Creates a discrete rank one operator.

_Solver

Actual solve of a sparse linear system.

Functions

as_matrix(operator)

Convert a discrte operator into a dense matrix.

class bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase(dtype, shape)

Bases: scipy.sparse.linalg.interface.LinearOperator

Discrete boundary operator base.

property A

Return dense matrix.

__add__(other)

Sum of two operators.

__neg__()

Negation.

__sub__(other)

Subtraction.

dot(other)

Product with other objects.

__mul__(other)

Product with other objects.

__rmul__(other)

Reverse product.

abstract to_dense()

Return dense matrix.

abstract to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator._ScaledDiscreteOperator(op, alpha)

Bases: _DiscreteOperatorBase

Return a scaled operator.

_matvec(x)

Matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator._SumDiscreteOperator(op1, op2)

Bases: _DiscreteOperatorBase

Return a sum operator.

_matvec(x)

Evaluate matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator._ProductDiscreteOperator(op1, op2)

Bases: _DiscreteOperatorBase

Product of two operators.

_matvec(x)

Evaluate matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.GenericDiscreteBoundaryOperator(evaluator)

Bases: _DiscreteOperatorBase

Discrete boundary operator that implements a matvec routine.

_matvec(x)

Mutliply the operator by a vector.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.DenseDiscreteBoundaryOperator(impl)

Bases: _DiscreteOperatorBase

Main class for the discrete form of dense nonlocal operators.

This class derives from scipy.sparse.linalg.interface.LinearOperator and thereby implements the SciPy LinearOperator protocol.

_matmat(x)

Multiply the operator by a matrix or operator.

__add__(other)

Add two operators.

__neg__()

Negate the operator.

__mul__(other)

Multiply.

dot(other)

Form the product with another object.

__rmul__(other)

Multiply.

_transpose()

Transpose of the operator.

_adjoint()

Adjoint of the operator.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.DiagonalOperator(values, shape=None)

Bases: _DiscreteOperatorBase

Main class for discrete diagonal operators.

This class derives from scipy.sparse.linalg.interface.LinearOperator and thereby implements the SciPy LinearOperator protocol.

get_diagonal()

Get the diagonal values.

_matvec(x)

Multiply the operator by a vector.

__add__(other)

Add.

__neg__()

Negate.

__mul__(other)

Multiply.

dot(other)

Product with other objects.

__rmul__(other)

Multiply.

_transpose()

Transpose of the operator.

_adjoint()

Adjoint of the operator.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.SparseDiscreteBoundaryOperator(impl)

Bases: _DiscreteOperatorBase

Main class for the discrete form of sparse operators.

This class derives from scipy.sparse.linalg.interface.LinearOperator and thereby implements the SciPy LinearOperator protocol.

property A

Return dense matrix.

_matmat(vec)

Multiply the operator with a numpy vector or matrix x.

_transpose()

Return the transpose of the discrete operator.

_adjoint()

Return the adjoint of the discrete operator.

__add__(other)

Add.

__neg__()

Negate.

__mul__(other)

Multiply.

dot(other)

Product with other objects.

__rmul__(other)

Multiply.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.InverseSparseDiscreteBoundaryOperator(operator)

Bases: _DiscreteOperatorBase

Apply the (pseudo-)inverse of a sparse operator.

This class uses a Sparse LU-Decomposition (in the case of a square matrix) or a sparse normal equation to provide the application of an inverse to a sparse operator.

This class derives from scipy.sparse.linalg.interface.LinearOperator and thereby implements the SciPy LinearOperator protocol.

Parameters

operatorbempp.api.SparseDiscreteBoundaryOperator

Sparse operator to be inverted.

_matmat(vec)

Implemententation of matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.ZeroDiscreteBoundaryOperator(rows, columns)

Bases: _DiscreteOperatorBase

A discrete operator that represents a zero operator.

This class derives from scipy.sparse.linalg.interface.LinearOperator and thereby implements the SciPy LinearOperator protocol.

Parameters

rowsint

The number of rows in the operator.

columnsint

The number of columns in the operator.

_matmat(x)

Multiply operator by a matrix.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp.api.assembly.discrete_boundary_operator.DiscreteRankOneOperator(column, row)

Bases: _DiscreteOperatorBase

Creates a discrete rank one operator.

This class represents a rank one operator given by column * row, where column is column is interpreted as a (m, 1) array and row as a (1, n) array.

Parameters

columnnp.array

A column vector

rownp.array

A row vector

_matvec(x)

Multiply operator by a vector.

_rmatvec(x)

Multiply.

_transpose()

Find the transpose.

_adjoint()

Find the adjoint.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

bempp.api.assembly.discrete_boundary_operator.as_matrix(operator)

Convert a discrte operator into a dense matrix.

Parameters

operatorscipy.sparse.linalg.interface.LinearOperator

The linear operator to be converted into a matrix.

Notes

Note that this function may be slow depending on how the original discrete operator was stored. In the case of a dense assembly simple the underlying NumPy matrix is returned. For sparse matrices the corresponding Scipy sparse matrix is returned. Otherwise, the operator needs to be converted to an array, which can take a long time depending on the assembler type.

class bempp.api.assembly.discrete_boundary_operator._Solver(operator)

Bases: object

Actual solve of a sparse linear system.

property shape

Return the shape of the inverse operator.

property dtype

Return the dtype.

solve(rhs)

Solve with right-hand side mat.