[ 
https://issues.apache.org/jira/browse/MATH-664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186213#comment-13186213
 ] 

Luc Maisonobe commented on MATH-664:
------------------------------------

The testNonInvertible is really non-invertible. It is based on a singular 3x3 
matrix: [[1, 2, -3], [2, 1, 3], [-3, 0, -9]]. The third row of this matrix is a 
linear combination of the two first rows (it is row 1 minus twice row 2).

This is really a numerical problem. If you replace in this test the last call 
optimizer.getCovariances() with optimizer.getCovariances(1.5e-14), the expected 
exception is thrown. In this case, the computed diagonal rdiag are 
-33.34666400106613, -7.05859341563135 and 1.2434497875801753E-14. The last 
value should really be 0 if perfect arithmetic were available.

So I would suggest to keep the test but use it with a threshold that is 
consistent with the problem at hand. The value I suggest (1.5e-14) is slightly 
above the value of the last element and triggers the singularity detection.

The goal of this test is really to check error are handled properly when 
settings are good, so it makes sense to just update the test now that the 
threshold can be set by user.

Thanks for having digged into this.
                
> Replace "LUDecompostionImpl" with "QRDecompositionImpl" in 
> "AbstractLeastSquaresOptimizer"
> ------------------------------------------------------------------------------------------
>
>                 Key: MATH-664
>                 URL: https://issues.apache.org/jira/browse/MATH-664
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.0
>
>
> In some cases, the "getCovariances()" method throws a 
> "SingularMatrixException". This can be avoided by using "QR" instead of "LU" 
> decomposition.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to