Go to the documentation of this file.
33 #include <Eigen/Cholesky>
35 #include <Eigen/Dense>
46 assert(
A.rows() ==
B.rows());
47 assert(R.rows() ==
B.cols());
50 const int p =
A.rows();
53 Eigen::MatrixXd R_inv_B_t = R_cholesky.solve(
B.transpose());
58 Eigen::MatrixXd H(2 * p, 2 * p);
59 H <<
A, -
B * R_inv_B_t, -Q, -
A.transpose();
63 "Eigenvalues of the Hamiltonian are close to the imaginary axis. Numerically unstable results are expected.");
68 if (G && success) *G = R_inv_B_t *
X;
75 assert(H.rows() % 2 == 0);
80 Eigen::MatrixXd T = schur.matrixT();
81 Eigen::MatrixXd U = schur.matrixU();
87 const int p = H.rows() / 2;
89 if (!success || p != subspace_dim)
return false;
99 X = U1_svd.solve(U.block(p, 0, p, p).transpose());
105 Eigen::VectorXcd
eig =
matrix.eigenvalues();
106 for (
int i = 0; i <
eig.size(); ++i)
184 assert(
A.rows() ==
B.rows());
185 assert(
A.rows() == G.cols());
186 assert(G.rows() ==
B.cols());
188 Eigen::VectorXcd
eig = (
A -
B * G).eigenvalues();
189 for (
int i = 0; i <
eig.size(); ++i)
191 if (
eig[i].
real() >= 0)
return false;
201 assert(
A.rows() ==
B.rows());
202 assert(R.rows() ==
B.cols());
205 const int p =
A.rows();
208 Eigen::MatrixXd R_inv_B_t = R_cholesky.solve(
B.transpose());
210 Eigen::MatrixXd H(2 * p, 2 * p);
211 H <<
A, -
B * R_inv_B_t, -Q, -
A.transpose();
#define PRINT_WARNING_COND_NAMED(cond, msg)
bool have_equal_size(const Eigen::MatrixBase< DerivedA > &matrix1, const Eigen::MatrixBase< DerivedB > &matrix2)
Determine if two matrices exhibit equal sizes/dimensions.
static bool hasRealPartsCloseToZero(const Eigen::Ref< const Eigen::MatrixXd > &matrix)
Check if the real parts of the provided matrix are close to zero.
static bool isNumericallyStable(const Eigen::Ref< const Eigen::MatrixXd > &A, const Eigen::Ref< const Eigen::MatrixXd > &B, const Eigen::Ref< const Eigen::MatrixXd > &Q, const Eigen::Ref< const Eigen::MatrixXd > &R)
Determine if solving the riccati equation seems to be numerically stable.
static bool isClosedLoopStable(const Eigen::Ref< const Eigen::MatrixXd > &A, const Eigen::Ref< const Eigen::MatrixXd > &B, const Eigen::Ref< const Eigen::MatrixXd > &G)
Determine if the closed-loop system is stable.
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
static bool hasNegativeRealPart(const Eigen::Ref< const Eigen::MatrixXd > &block)
Predicate for Schur block ordering (see solveRiccatiHamiltonianSchur())
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE AbsReturnType abs() const
Performs a real Schur decomposition of a square matrix.
bool is_square(const Eigen::MatrixBase< Derived > &matrix)
Determine if a given matrix is square.
MatrixType B(b, *n, *nrhs, *ldb)
Robust Cholesky decomposition of a matrix with pivoting.
SelfAdjointEigenSolver< PlainMatrixType > eig(mat, computeVectors?ComputeEigenvectors:EigenvaluesOnly)
Two-sided Jacobi SVD decomposition of a rectangular matrix.
A matrix or vector expression mapping an existing expression.
static bool solveRiccatiHamiltonianSchur(const Eigen::MatrixXd &H, Eigen::MatrixXd &X)
Solve Hamiltonian via Schur method.
static bool solve(const Eigen::Ref< const Eigen::MatrixXd > &A, const Eigen::Ref< const Eigen::MatrixXd > &B, const Eigen::Ref< const Eigen::MatrixXd > &Q, const Eigen::Ref< const Eigen::MatrixXd > &R, Eigen::MatrixXd &X, Eigen::MatrixXd *G=nullptr)
Solve continuous-time algebraic Riccati equation.
MatrixType A(a, *n, *n, *lda)
bool reorder_schur_blocks(Eigen::Ref< Eigen::MatrixXd > T, Eigen::Ref< Eigen::MatrixXd > Q, Predicate predicate, int *subspace_dim, bool standardize)
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:05:36