orocos / orocos-bayesian-filtering

The orocos Bayesian Filtering Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SymmetricMatrix boost wrapper returns incorrect value

jamesgunnfiveai opened this issue · comments

When calculating the determinant of a 3x3 SymmetricMatrix using the boost wrapper, the value returned is incorrect. For example, 2.33 is returned for the symmetric matrix ((3,2,0),(2,2,0),(0,0,0.5)) which has unit determinant.

I suspect this is because matrix_BOOST.cpp assumes the result of LU decomposition will be a symmetric matrix in the implementation of SymmetricMatrix.determinant(), but this is not true. Similarly for the .inverse function. This does not show up in testing because line 542 of matrixwrapper_test.cpp uses a Matrix (rather than a SymmetricMatrix) when attempting to test the determinant of a SymmetricMatrix.

Thanks for submitting!
Bug confirmed, and added a test in commit 6c6a306 . Patch that fixes the issue is also welcome ;-)

Fair point! I didn't have time midweek but I've opened a pull request with a patch and fixed up the tests.

Thanks, seems to work flawless!

Thank you for finding this, it was causing havoc with me getting negative determinants my symetric matrices and thus Guassiona::ProbabilityGet not working.