nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
riccati.hpp
Go to the documentation of this file.
1
3
// toolboxes/control/include/nk/control/riccati/riccati.hpp
4
//
5
// Algebraic Riccati equation solvers.
6
//
7
// care: continuous-time ARE AᵀX + XA − XBR⁻¹BᵀX + Q = 0
8
// dare: discrete-time ARE AᵀXA − X − AᵀXB(R + BᵀXB)⁻¹BᵀXA + Q = 0
9
//
10
// Both are solved by the matrix sign-function method (no Schur
11
// ordering): a Newton iteration drives an embedding matrix to its
12
// sign, whose stable invariant subspace yields X via a small
13
// least-squares solve. care embeds the Hamiltonian directly; dare
14
// embeds the symplectic matrix through a Cayley transform that maps the
15
// unit disk onto the left half-plane so the same sign machinery applies.
16
//
17
// Practical for the state dims that show up in textbook control
18
// problems (n ≲ 32). dare requires a nonsingular A (the explicit
19
// symplectic form needs A⁻¹); the singular-A pencil path would need a
20
// QZ solver we do not have yet.
21
22
#pragma once
23
24
#include <memory_resource>
25
#include <nk/value/value.hpp>
26
27
namespace
nk::control {
28
31
32
35
struct
RiccatiResult
{
36
Value
X
;
37
Value
L
;
38
Value
G
;
39
};
40
57
RiccatiResult
care
(
const
Value
&A,
const
Value
&B,
const
Value
&Q,
58
const
Value
&R, std::pmr::memory_resource *mr =
nullptr
);
59
77
RiccatiResult
dare
(
const
Value
&A,
const
Value
&B,
const
Value
&Q,
78
const
Value
&R, std::pmr::memory_resource *mr =
nullptr
);
79
80
82
}
// namespace nk::control
nk::Value
Core MATLAB-compatible multidimensional array and scalar value type.
Definition
value.hpp:61
nk::control::care
RiccatiResult care(const Value &A, const Value &B, const Value &Q, const Value &R, std::pmr::memory_resource *mr=nullptr)
Continuous-time algebraic Riccati equation ([X, L, G] = care(A, B, Q, R)).
nk::control::dare
RiccatiResult dare(const Value &A, const Value &B, const Value &Q, const Value &R, std::pmr::memory_resource *mr=nullptr)
Discrete-time algebraic Riccati equation ([X, L, G] = dare(A, B, Q, R)).
nk::control::RiccatiResult
Result of an algebraic Riccati solve, matching MATLAB's [X, L, G] output order for care / dare.
Definition
riccati.hpp:35
nk::control::RiccatiResult::G
Value G
Optimal state-feedback gain (m×n).
Definition
riccati.hpp:38
nk::control::RiccatiResult::L
Value L
Closed-loop eigenvalues eig(A − B·G) (column, may be complex).
Definition
riccati.hpp:37
nk::control::RiccatiResult::X
Value X
Stabilizing solution (symmetric positive-semidefinite).
Definition
riccati.hpp:36
src
toolboxes
control
include
nk
control
riccati
riccati.hpp
Generated by
1.17.0