ContinuousAlgebraicRiccatiSolver<T>
Models & Types · AiDotNet.Control
Solves the continuous-time algebraic Riccati equation by the matrix sign-function iteration.
For Beginners
The Hamiltonian matrix packs the dynamics and the costs into one object whose “stable half” is the answer. The sign function is a way of separating that stable half from the unstable one using only repeated matrix inversion — no eigenvalues are ever computed.
How It Works
Solves AᵀP + PA − PBR⁻¹BᵀP + Q = 0 for the stabilizing P, implementing the method of
J. D. Roberts, “Linear model reduction and solution of the algebraic Riccati equation by use of
the sign function”, International Journal of Control 32(4), 1980, pp. 677-687 (circulated
as a Cambridge report in 1971), with the scaling of R. Byers, “Solving the algebraic Riccati
equation with the matrix sign function”, Linear Algebra and its Applications 85, 1987,
pp. 267-279.
How it works. The solution is encoded in the stable invariant subspace of the Hamiltonian
matrix H = [[A, −G], [−Q, −Aᵀ]] where G = BR⁻¹Bᵀ. The matrix sign function maps every
eigenvalue with negative real part to −1 and every one with positive real part to
+1, leaving the eigenvectors untouched — so sign(H) + I annihilates exactly the
stable subspace. Reading P off is then a least-squares solve. The sign function itself
comes from Newton’s iteration on Z² = I, namely Z ← ½(Z + Z⁻¹), which converges
quadratically and needs nothing but matrix inversion.
Why not eigenvectors directly. The classical route extracts the stable subspace from an
eigendecomposition of H. But H is not symmetric, and its eigenvalues are generally
complex — so that route needs complex arithmetic, or an ordered real Schur factorization, to be
correct. The sign-function iteration stays in real arithmetic throughout and uses only the LU
factorization already in this library.
The iteration converges precisely when H has no eigenvalues on the imaginary axis, which is
the same condition under which a stabilizing solution exists at all — so the method fails exactly
when, and only when, there is nothing to find.
Constructors
| Constructor | Summary |
|---|---|
ContinuousAlgebraicRiccatiSolver() |
Creates a continuous-time Riccati solver with the default options. |
ContinuousAlgebraicRiccatiSolver(AlgebraicRiccatiSolverOptions options) |
Creates a continuous-time Riccati solver. |
Methods
| Method | Summary |
|---|---|
AlgebraicRiccatiSolution<T> Solve(Matrix<T> stateMatrix, Matrix<T> inputMatrix, Matrix<T> stateCost, Matrix<T> inputCost) |
Solves the continuous-time algebraic Riccati equation. |
Matrix<T> ComputeGain(Matrix<T> solution, Matrix<T> inputMatrix, Matrix<T> inputCost) |
Computes the optimal feedback gain K = R⁻¹BᵀP, so the optimal input is u = −Kx. |