capytaine.bem.linear_solvers module

class capytaine.bem.linear_solvers.AbstractLUDecomposedMatrix[source]

Bases: ABC

Base class of the LU decompositions of matrices.

New matrix types (e.g. matrices stored with another array library) can be supported by the linear solvers of Capytaine by registering a function returning a subclass of this class with lu_decompose().

As for an array of the array API standard, the subclasses define the method __array_namespace__ and the attribute (or property) device, returning the array library and the device of the matrix that has been decomposed.

device: Any
dtype: object
shape: tuple
abstractmethod solve(b)[source]

Solve the linear system with the decomposed matrix as left-hand side and b as right-hand side.

class capytaine.bem.linear_solvers.LUDecomposedMatrix(A: NDArray, *, overwrite_a: bool = False)[source]

Bases: AbstractLUDecomposedMatrix

solve(b: ndarray) → ndarray[source]

Solve the linear system with the decomposed matrix as left-hand side and b as right-hand side.

capytaine.bem.linear_solvers.has_been_lu_decomposed(A)[source]
capytaine.bem.linear_solvers.lu_decompose(A, *, overwrite_a: bool = False) → AbstractLUDecomposedMatrix[source]
capytaine.bem.linear_solvers.lu_decompose(A: ndarray, *, overwrite_a: bool = False)
capytaine.bem.linear_solvers.lu_decompose(A: BlockDiagonalMatrix, *, overwrite_a: bool = False)
capytaine.bem.linear_solvers.lu_decompose(A: BlockCirculantMatrix, *, overwrite_a: bool = False)
capytaine.bem.linear_solvers.lu_decompose(A: NestedBlockCirculantMatrix, *, overwrite_a: bool = False)

Compute the LU decomposition of A.

This is a functools.singledispatch() function: the implementation for a new type of matrix can be added with lu_decompose.register(MyMatrix, my_function), where my_function(A, *, overwrite_a=False) returns an AbstractLUDecomposedMatrix.