Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle numerical errors properly #8

Open
mherb opened this issue Mar 4, 2016 · 4 comments
Open

Handle numerical errors properly #8

mherb opened this issue Mar 4, 2016 · 4 comments
Labels

Comments

@mherb
Copy link
Owner

mherb commented Mar 4, 2016

No description provided.

@mherb mherb added the bug label Mar 4, 2016
@LuTaonuwhu
Copy link

Do the numerical errors mean non-positive definite of square root S in SR-UKF and non-positive definite of covariance matrix P in UKF?
for exmaple, here
S.rankUpdate( U.col(i), -1 );

            if( S.info() == Eigen::NumericalIssue )
            {
                // TODO: handle numerical issues in some sensible way
                return false;
            }

@mherb
Copy link
Owner Author

mherb commented Jul 29, 2018

Yes, this is about these kind of errors which usually occur when the covariance matrix is not positive definite.

One approach to handle these would be to force the covariance to be positive definite for instance using the method proposed by Higham (adapted matlab implementation here).

Unfortunately I do not have the time right now to implement this, but contributions are of course very welcome.

@LuTaonuwhu
Copy link

Thanks for your information mherb, I have also notice a solution like this. I will try to fix it.

@jwdinius
Copy link

But what if the matrix is negative definite? There should be a check before even attempting a matrix rescaling; something like:

  Eigen::SelfAdjointEigenSolver< Covariance<StateType> > eigenSolver(this->P);
  if (eigenSolver.info() != Eigen::SUCCESS || eigenSolver.eigenvalues().minCoeff() < 0) {
    //! either the solver failed, which could mean the matrix is not symmetric (self-adjoint) OR
    //! there are negative eigenvalues, meaning the covariance matrix is not pos semidefinite
    //! either way, an exception should be raised
  }

I like this approach because of the ability to touch the internal filter state and covariance via the init and setCovariance public methods within the filter base class. If the caller does something bogus, the implementation could complain about it.

peno2 pushed a commit to peno2/kalman that referenced this issue Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants