pymoto.solvers.SolverSparsePardiso
- class pymoto.solvers.SolverSparsePardiso(A: spmatrix = None, symmetric: bool = None, hermitian: bool = None, positive_definite: bool = None, size_limit_storage: int = 50000000.0)
Solver wrapper Intel MKL Pardiso solver, which is a very fast and flexible multi-threaded solver
Complex-valued matrices are currently not supported
Uses the Python interface to the Intel MKL PARDISO library for solving large sparse linear systems of equations \(\mathbf{Ax}=\mathbf{b}\).
References
Intel MKL Python wrapper `Intel MKL Pardiso <https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/
top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-iface.html>`_
- __init__(A: spmatrix = None, symmetric: bool = None, hermitian: bool = None, positive_definite: bool = None, size_limit_storage: int = 50000000.0)
Initialize Pardiso linear solver
- Parameters:
A (scipy.sparse.spmatrix, optional) – The matrix. Defaults to None.
symmetric (bool, optional) – If it is already known if the matrix is symmetric, you can provide it here
hermitian (bool, optional) – If it is already known if the matrix is Hermitian, you can provide it here
positive_definite (bool, optional) – If positive-definiteness is known, provide it here
size_limit_storage (int, optional) – Limit for MKL memory use
Methods
__init__([A, symmetric, hermitian, ...])Initialize Pardiso linear solver
residual(A, x, b[, trans])Calculates the (relative) residual of the linear system of equations
solve(b[, x0, trans])solve Ax=b for x
update(A)Factorize the matrix A, the factorization will automatically be used if the same matrix A is passed to the solve method.
Attributes
- defined = False
- update(A)
Factorize the matrix A, the factorization will automatically be used if the same matrix A is passed to the solve method. This will drastically increase the speed of solve, if solve is called more than once for the same matrix A
- Parameters:
A – sparse square CSR or CSC matrix (
scipy.sparse.csr.csr_matrix)
- solve(b, x0=None, trans='N')
solve Ax=b for x
- Parameters:
A (scipy.sparse.csr.csr_matrix) – sparse square CSR matrix , CSC matrix also possible
b (numpy.ndarray) – right-hand side(s), b.shape[0] needs to be the same as A.shape[0]
x0 (unused)
trans (optional) – Indicate which system to solve (Normal, Transposed, or Hermitian transposed)
- Returns:
Solution of the system of linear equations, same shape as input b
- clear_factorization()
- static residual(A, x, b, trans='N')
Calculates the (relative) residual of the linear system of equations
The residual is calculated as \(r = \frac{\left| \mathbf{A} \mathbf{x} - \mathbf{b} \right|}{\left| \mathbf{b} \right|}\)
- Parameters:
A – The matrix
x – Solution vector
b – Right-hand side
trans (optional) – Matrix tranformation (N is normal, T is transposed, H is hermitian transposed)
- Returns:
Residual value