Linear solvers

Direct linear solvers

Each linear solver employed in MadNLP implements the following interface.

MadNLP.AbstractLinearSolverType
AbstractLinearSolver

Abstract type for linear solver targeting the resolution of the linear system $Ax=b$.

MadNLP.introduceFunction
introduce(::AbstractLinearSolver)

Print the name of the linear solver.

MadNLP.factorize!Function
factorize!(::AbstractLinearSolver)

Factorize the matrix $A$ and updates the factors inside the AbstractLinearSolver instance.

MadNLP.solve!Function
solve!(::AbstractLinearSolver, x::AbstractVector)

Solve the linear system $Ax = b$.

This function assumes the linear system has been factorized previously with factorize!.

MadNLP.is_inertiaFunction
is_inertia(::AbstractLinearSolver)

Return true if the linear solver supports the computation of the inertia of the linear system.

MadNLP.inertiaFunction
inertia(::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!Function
solve_refine!(x, ::AbstractIterator, b)

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.