:py:mod:`bempp.api.assembly.discrete_boundary_operator` ======================================================= .. py:module:: bempp.api.assembly.discrete_boundary_operator .. autoapi-nested-parse:: Data structures for assembled boundary operators. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: bempp.api.assembly.discrete_boundary_operator._DiscreteOperatorBase bempp.api.assembly.discrete_boundary_operator._ScaledDiscreteOperator bempp.api.assembly.discrete_boundary_operator._SumDiscreteOperator bempp.api.assembly.discrete_boundary_operator._ProductDiscreteOperator bempp.api.assembly.discrete_boundary_operator.GenericDiscreteBoundaryOperator bempp.api.assembly.discrete_boundary_operator.DenseDiscreteBoundaryOperator bempp.api.assembly.discrete_boundary_operator.DiagonalOperator bempp.api.assembly.discrete_boundary_operator.SparseDiscreteBoundaryOperator bempp.api.assembly.discrete_boundary_operator.InverseSparseDiscreteBoundaryOperator bempp.api.assembly.discrete_boundary_operator.ZeroDiscreteBoundaryOperator bempp.api.assembly.discrete_boundary_operator.DiscreteRankOneOperator bempp.api.assembly.discrete_boundary_operator._Solver Functions ~~~~~~~~~ .. autoapisummary:: bempp.api.assembly.discrete_boundary_operator.as_matrix .. py:class:: _DiscreteOperatorBase(dtype, shape) Bases: :py:obj:`scipy.sparse.linalg.interface.LinearOperator` Discrete boundary operator base. .. py:property:: A Return dense matrix. .. py:method:: __add__(other) Sum of two operators. .. py:method:: __neg__() Negation. .. py:method:: __sub__(other) Subtraction. .. py:method:: dot(other) Product with other objects. .. py:method:: __mul__(other) Product with other objects. .. py:method:: __rmul__(other) Reverse product. .. py:method:: to_dense() :abstractmethod: Return dense matrix. .. py:method:: to_sparse() :abstractmethod: Return sparse matrix if operator is sparse. .. py:class:: _ScaledDiscreteOperator(op, alpha) Bases: :py:obj:`_DiscreteOperatorBase` Return a scaled operator. .. py:method:: _matvec(x) Matvec. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: _SumDiscreteOperator(op1, op2) Bases: :py:obj:`_DiscreteOperatorBase` Return a sum operator. .. py:method:: _matvec(x) Evaluate matvec. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: _ProductDiscreteOperator(op1, op2) Bases: :py:obj:`_DiscreteOperatorBase` Product of two operators. .. py:method:: _matvec(x) Evaluate matvec. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: GenericDiscreteBoundaryOperator(evaluator) Bases: :py:obj:`_DiscreteOperatorBase` Discrete boundary operator that implements a matvec routine. .. py:method:: _matvec(x) Mutliply the operator by a vector. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: DenseDiscreteBoundaryOperator(impl) Bases: :py:obj:`_DiscreteOperatorBase` Main class for the discrete form of dense nonlocal operators. This class derives from :class:`scipy.sparse.linalg.interface.LinearOperator` and thereby implements the SciPy LinearOperator protocol. .. py:method:: _matmat(x) Multiply the operator by a matrix or operator. .. py:method:: __add__(other) Add two operators. .. py:method:: __neg__() Negate the operator. .. py:method:: __mul__(other) Multiply. .. py:method:: dot(other) Form the product with another object. .. py:method:: __rmul__(other) Multiply. .. py:method:: _transpose() Transpose of the operator. .. py:method:: _adjoint() Adjoint of the operator. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: DiagonalOperator(values, shape=None) Bases: :py:obj:`_DiscreteOperatorBase` Main class for discrete diagonal operators. This class derives from :class:`scipy.sparse.linalg.interface.LinearOperator` and thereby implements the SciPy LinearOperator protocol. .. py:method:: get_diagonal() Get the diagonal values. .. py:method:: _matvec(x) Multiply the operator by a vector. .. py:method:: __add__(other) Add. .. py:method:: __neg__() Negate. .. py:method:: __mul__(other) Multiply. .. py:method:: dot(other) Product with other objects. .. py:method:: __rmul__(other) Multiply. .. py:method:: _transpose() Transpose of the operator. .. py:method:: _adjoint() Adjoint of the operator. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: SparseDiscreteBoundaryOperator(impl) Bases: :py:obj:`_DiscreteOperatorBase` Main class for the discrete form of sparse operators. This class derives from :class:`scipy.sparse.linalg.interface.LinearOperator` and thereby implements the SciPy LinearOperator protocol. .. py:property:: A Return dense matrix. .. py:method:: _matmat(vec) Multiply the operator with a numpy vector or matrix x. .. py:method:: _transpose() Return the transpose of the discrete operator. .. py:method:: _adjoint() Return the adjoint of the discrete operator. .. py:method:: __add__(other) Add. .. py:method:: __neg__() Negate. .. py:method:: __mul__(other) Multiply. .. py:method:: dot(other) Product with other objects. .. py:method:: __rmul__(other) Multiply. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: InverseSparseDiscreteBoundaryOperator(operator) Bases: :py:obj:`_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 :class:`scipy.sparse.linalg.interface.LinearOperator` and thereby implements the SciPy LinearOperator protocol. Parameters ---------- operator : bempp.api.SparseDiscreteBoundaryOperator Sparse operator to be inverted. .. py:method:: _matmat(vec) Implemententation of matvec. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: ZeroDiscreteBoundaryOperator(rows, columns) Bases: :py:obj:`_DiscreteOperatorBase` A discrete operator that represents a zero operator. This class derives from :class:`scipy.sparse.linalg.interface.LinearOperator` and thereby implements the SciPy LinearOperator protocol. Parameters ---------- rows : int The number of rows in the operator. columns : int The number of columns in the operator. .. py:method:: _matmat(x) Multiply operator by a matrix. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:class:: DiscreteRankOneOperator(column, row) Bases: :py:obj:`_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 ---------- column : np.array A column vector row : np.array A row vector .. py:method:: _matvec(x) Multiply operator by a vector. .. py:method:: _rmatvec(x) Multiply. .. py:method:: _transpose() Find the transpose. .. py:method:: _adjoint() Find the adjoint. .. py:method:: to_dense() Return dense matrix. .. py:method:: to_sparse() Return sparse matrix if operator is sparse. .. py:function:: as_matrix(operator) Convert a discrte operator into a dense matrix. Parameters ---------- operator : scipy.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. .. py:class:: _Solver(operator) Bases: :py:obj:`object` Actual solve of a sparse linear system. .. py:property:: shape Return the shape of the inverse operator. .. py:property:: dtype Return the dtype. .. py:method:: solve(rhs) Solve with right-hand side mat.