LUDecompositionNR detects singular matrix, but ignores it

20 views
Skip to first unread message

Luke Nezda

unread,
Mar 4, 2013, 7:25:38 PM3/4/13
to efficient-java-matrix-library-discuss
Hello,

In LUDecompositionNR, lines 80 and 81 (below) might as well just throw
a SingularMatrixException because indx is invalid (i.e., invert calls
LUDecompositionBase._solveVectorInternal which falls over on line
220):
// TODO flag as singular
indx[k] = -1;

Can this be put into v22? For now, I'm gonna catch
ArrayIndexOutOfBoundsException and throw SingularMatrixException
myself.

Please advise,
- Luke

Peter A

unread,
Mar 6, 2013, 6:07:28 PM3/6/13
to efficient-java-mat...@googlegroups.com
That is a bug and will be fixed, but it's not recommended that you use LUDecompositionNR.  Instead use whatever DecompositionFactory.lu() returns, which will always be LUDecompositionAlt.  I'm going to push LUDecompositionNR into the experimental code directory since there is no real reason to use it, but I don't want to delete it for benchmarking purposes.

- Peter


--
You received this message because you are subscribed to the Google Groups "efficient-java-matrix-library-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to efficient-java-matrix-li...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
"Now, now my good man, this is no time for making enemies."    — Voltaire (1694-1778), on his deathbed in response to a priest asking that he renounce Satan.

Luke Nezda

unread,
Mar 9, 2013, 11:03:02 PM3/9/13
to efficient-java-matrix-library-discuss
Hmm, for many of the matrices I've been inverting, LUDecompositionAlt
(default via path CommonOps.invert) often failed while
LUDecompositionNR usually worked. I'll have to do some more
testing... maybe I can provide some test matrices to illustrate.

- Luke
> > For more options, visithttps://groups.google.com/groups/opt_out.

Peter A

unread,
Mar 14, 2013, 12:29:01 AM3/14/13
to efficient-java-mat...@googlegroups.com
Having test matrices would be helpful.  I just ran the build in stability tests and those results show that they are comparable.  How do you detect the failure case?  For example, do you consider it a failure only when the algorithm detects a failure or the matrix is incorrect based on some error metric?

If you are trying to invert nearly singular matrices, you might want to consider using the pseudo inverse (QR with pivot) or SVD instead.

- Peter

For more options, visit https://groups.google.com/groups/opt_out.


Reply all
Reply to author
Forward
0 new messages