Linear solvers
Direct linear solvers
Each linear solver employed in MadNLP implements the following interface.
MadNLP.AbstractLinearSolver
— TypeAbstractLinearSolver
Abstract type for linear solver targeting the resolution of the linear system $Ax=b$.
MadNLP.introduce
— Functionintroduce(::AbstractLinearSolver)
Print the name of the linear solver.
MadNLP.factorize!
— Functionfactorize!(::AbstractLinearSolver)
Factorize the matrix $A$ and updates the factors inside the AbstractLinearSolver
instance.
SolverCore.solve!
— Functionsolve!(::AbstractLinearSolver, x::AbstractVector)
Solve the linear system $Ax = b$.
This function assumes the linear system has been factorized previously with factorize!
.
MadNLP.is_inertia
— Functionis_inertia(::AbstractLinearSolver)
Return true
if the linear solver supports the computation of the inertia of the linear system.
MadNLP.inertia
— Functioninertia(::AbstractLinearSolver)
Return the inertia (n, m, p)
of the linear system as a tuple.
Note
The inertia is defined as a tuple $(n, m, p)$, with
- $n$: number of positive eigenvalues
- $m$: number of negative eigenvalues
- $p$: number of zero eigenvalues
Iterative refinement
MadNLP uses iterative refinement to improve the accuracy of the solution returned by the linear solver.
MadNLP.solve_refine!
— Functionsolve_refine!(x::VT, ::AbstractIterator, b::VT, w::VT) where {VT <: AbstractKKTVector}
Solve the linear system $Ax = b$ using iterative refinement. The object AbstractIterator
stores an instance of a AbstractLinearSolver
for the backsolve operations.
Notes
This function assumes the matrix stored in the linear solver has been factorized previously.