Is your feature request related to a problem? Please describe.
Our iterative DARE solver based on the structure-preserving doubling algorithm can produce inaccurate solutions if the system matrix has vastly different eigenvalues (e.g., fast velocity dynamics and a slow decaying integrator).
Describe the solution you'd like
SciPy's direct DARE solver performs matrix balancing via scipy.linalg.matrix_balance (with permuting and scaling enabled) before the solve. That function uses LAPACK's GEBAL. We want to avoid a dependency on Fortran, so we'll have to write our own C++ routine using Eigen for building the diagonal similarity transformation.
We also need to determine if there's some matrix structure to preserve during the rebalancing process. SciPy's solver mentions preserving symplectic structure, but I don't know if the same applies to wpimath's solver, or what that looks like implemented.
Is your feature request related to a problem? Please describe.
Our iterative DARE solver based on the structure-preserving doubling algorithm can produce inaccurate solutions if the system matrix has vastly different eigenvalues (e.g., fast velocity dynamics and a slow decaying integrator).
Describe the solution you'd like
SciPy's direct DARE solver performs matrix balancing via scipy.linalg.matrix_balance (with permuting and scaling enabled) before the solve. That function uses LAPACK's GEBAL. We want to avoid a dependency on Fortran, so we'll have to write our own C++ routine using Eigen for building the diagonal similarity transformation.
We also need to determine if there's some matrix structure to preserve during the rebalancing process. SciPy's solver mentions preserving symplectic structure, but I don't know if the same applies to wpimath's solver, or what that looks like implemented.