-
Notifications
You must be signed in to change notification settings - Fork 149
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
inverse of SMatrix sometimes fail with PDMat #1218
Comments
I think this problem occurs because of how
This sequence of operations to invert a positive-definite matrix does not guarantee that the inverse is also symmetric in the face of rounding errors. Using the same example as above:
Note that preserving symmetry after inversion is not an issue for
which is probably ensures that the return value is symmetric.
However, converting
I guess the |
I suspect that this bug is because the cholesky decomposition fills the lower-triangular elements with zeros (as mentioned in @194, and from here).I might be wrong.If
StaticArrays.cholesky
is used to construct a PDMat object, theninv
on this object can fail, when it needs to get the cholesky decomposition of the inverse, because the inverse can be slightly non-Hermitian.Here is a small example.
yet
J
is very well behaved. There is no error if the values ofJ
are slightly perturbed, or with a basic inverse:Also, there is no error if we don't combine
MMatrix
,PDMat
, and getting the inverse of that, as aPDMat
:The problem may come from the fact that the cholesky decomposition of a StaticArray stores a non-hermitian matrix:
In any case, the problem above is because the inverse of J, computed using its cholesky decomposition, is seen as non-hermitian:
If we slightly perturb the matrix, rounding errors don't appear, and the inverse is recognized as being hermitian:
This issue comes up frequently in what I do, actually. For now, I don't see any other workaround, other than giving up on using StaticArrays unfortunately. I would love to hear a work-around until this issue can be fixed.
The text was updated successfully, but these errors were encountered: