Created attachment 249 [details]
Check for non-positve definiteness
Currently SimplicialLLt results in NaN results for non-positive matrices, i.e. it takes the square root of a negative number.
Simple patch which checks for negative values and gracefully exits is attached.
Actually, it would be nice to have a possibility to further check the reason for failure, like in this case obtain the column and the value of d -- thus giving the possibility to increase the shift accordingly.
Thanks for the patch, applied in changeset: 4476:5ba5d5a711c1
I like the idea to add the possibility to get more information about the failure reason. I'm not sure about the API though. Perhaps:
Index firstSingularIndex() const;
RealScalar firstSingularValue() const;
but I'm not fan at all, especially the "Singular", so perhaps simply:
Index failureIndex() const;
RealScalar failureValue() const;
Feel free to propose something completely different.
I renamed the bug, since the original issue has long been fixed.
My suggestion would be to return (a reference to) a custom structure for each decomposition type instead of the current ComputationInfo. For compatibility, operators ==, != and cast to the old ComputationInfo should be implemented.
The custom info structure can then include any additional information which the decomposition gives. And of course similar decompositions can use the same info structures.
If we decide that using the decomposition shall throw if the computation failed (bug 631), we can include that information there as well.
I like this idea. This is compatible with existing code, easy to extend, and compatible with a possible exception throwing mechanism.
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/407.