bempp_cl.api.assembly.discrete_boundary_operator

Data structures for assembled boundary operators.

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.

Module Contents

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

Bases: scipy.sparse.linalg.interface.LinearOperator

Discrete boundary operator base.

__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.

property A

Return dense matrix.

abstractmethod to_dense()

Return dense matrix.

abstractmethod to_sparse()

Return sparse matrix if operator is sparse.

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

Bases: _DiscreteOperatorBase

Return a scaled operator.

_op
_alpha
_matvec(x)

Matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

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

Bases: _DiscreteOperatorBase

Return a sum operator.

_op1
_op2
_matvec(x)

Evaluate matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

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

Bases: _DiscreteOperatorBase

Product of two operators.

_op1
_op2
_matvec(x)

Evaluate matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

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

Bases: _DiscreteOperatorBase

Discrete boundary operator that implements a matvec routine.

_evaluator
_is_complex
_matvec(x)

Mutliply the operator by a vector.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp_cl.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.

_impl
_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_cl.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.

_values
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_cl.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.

_impl
_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.

property A

Return dense matrix.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp_cl.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_cl.api.SparseDiscreteBoundaryOperator

Sparse operator to be inverted.

_solver
_operator
_matmat(vec)

Implemententation of matvec.

to_dense()

Return dense matrix.

to_sparse()

Return sparse matrix if operator is sparse.

class bempp_cl.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_cl.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

_row
_column
_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_cl.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_cl.api.assembly.discrete_boundary_operator._Solver(operator)

Bases: object

Actual solve of a sparse linear system.

_solve_fun = None
_shape
_dtype
solve(rhs)

Solve with right-hand side mat.

property shape

Return the shape of the inverse operator.

property dtype

Return the dtype.