This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 407 - Return more information if matrix decomposition fails
Summary: Return more information if matrix decomposition fails
Status: DECISIONNEEDED
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: 3.1
Hardware: All All
: Low API Change
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 631
  Show dependency treegraph
 
Reported: 2012-01-14 22:43 UTC by Christoph Hertzberg
Modified: 2019-12-04 11:24 UTC (History)
3 users (show)



Attachments
Check for non-positve definiteness (1.28 KB, application/octet-stream)
2012-01-14 22:43 UTC, Christoph Hertzberg
no flags Details

Description Christoph Hertzberg 2012-01-14 22:43:51 UTC
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.
Comment 1 Christoph Hertzberg 2012-01-14 22:49:44 UTC
Side-note:
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.
Comment 2 Gael Guennebaud 2012-01-25 18:41:45 UTC
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.
Comment 3 Christoph Hertzberg 2013-10-28 11:29:48 UTC
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.
Comment 4 Gael Guennebaud 2013-10-28 16:31:01 UTC
I like this idea. This is compatible with existing code, easy to extend, and compatible with a possible exception throwing mechanism.
Comment 5 Nobody 2019-12-04 11:24:17 UTC
-- 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.

Note You need to log in before you can comment on or make changes to this bug.