capytaine.matrices.linear_solvers module
The linear solvers used in Capytaine.
They are based on numpy solvers with a thin layer for the handling of Hierarchical Toeplitz matrices.
-
class capytaine.matrices.linear_solvers.Counter[source]
Bases: object
-
class capytaine.matrices.linear_solvers.LUSolverWithCache[source]
Bases: object
Solve linear system with the LU decomposition.
The latest LU decomposition is kept in memory, if a system with the same matrix needs to be solved again, then the decomposition is reused.
Most of the complexity of this class comes from:
1. @lru_cache does not work because numpy arrays are not hashable. So a basic cache system has been recoded from scratch.
2. To be the default solver for the BasicMatrixEngine, the solver needs to support matrices for problems with one or two reflection symmetries.
Hence, a custom way to cache the LU decomposition of the matrices involved in the direct linear resolution of the symmetric problem.
-
cached_lu_decomp(A)[source]
-
lu_decomp(A)[source]
Return the LU decomposition of A.
If A is BlockSymmetricToeplitzMatrix, then return a list of LU decompositions for each block of the block diagonalisation of the matrix.
-
solve(A, b)[source]
-
solve_with_decomp(decomp, b)[source]
Solve the system using the precomputed LU decomposition.
TODO: find a better way to differentiate a LU decomposition (returned as tuple by sl.lu_factor)
and a set of LU decomposition (stored as a list in self.lu_decomp).
-
capytaine.matrices.linear_solvers.gmres_no_fft(A, b)[source]
-
capytaine.matrices.linear_solvers.solve_directly(A, b)[source]
-
capytaine.matrices.linear_solvers.solve_gmres(A, b)[source]
-
capytaine.matrices.linear_solvers.solve_precond_gmres(A_and_precond_data, b)[source]
Implementation of the preconditioner presented in
<https://doi.org/10.1007/978-3-031-50769-4_14>.