You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Axel Kramer (JIRA)" <ji...@apache.org> on 2009/12/31 13:03:29 UTC

[jira] Issue Comment Edited: (MATH-320) NaN singular value from SVD

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

Axel Kramer edited comment on MATH-320 at 12/31/09 12:02 PM:
-------------------------------------------------------------

This statement should print the values of the original matrix approximately:
{code:java} 
  System.out.println(svd.getU().multiply(svd.getS()).multiply(svd.getVT()));
{code} 

This is true for
{code:java} 
    public void testMath320A() {
{code} 
but not for
{code:java} 
    public void testMath320B() {
{code} 

For reference values try wolfram alpha:
N[SingularValueDecomposition[{{1,2},{1,2}}]]

      was (Author: axelclk):
    This statement should print the values of the original matrix approximately:
{code:java} 
  System.out.println(svd.getU().multiply(svd.getS()).multiply(svd.getVT()));
{code} 

This is true for
{code:java} 
    public void testMath320A() {
{code} 
but not for
{code:java} 
    public void testMath320B() {
{code} 

For reference valus try wolfram alpha:
N[SingularValueDecomposition[{{1,2},{1,2}}]]
  
> NaN singular value from SVD
> ---------------------------
>
>                 Key: MATH-320
>                 URL: https://issues.apache.org/jira/browse/MATH-320
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Linux (Ubuntu 9.10) java version "1.6.0_16"
>            Reporter: Dieter Vandenbussche
>
> The following jython code
> Start code
> from org.apache.commons.math.linear import *
>  
> Alist = [[1.0, 2.0, 3.0],[2.0,3.0,4.0],[3.0,5.0,7.0]]
>  
> A = Array2DRowRealMatrix(Alist)
>  
> decomp = SingularValueDecompositionImpl(A)
>  
> print decomp.getSingularValues()
> End code
> prints
> array('d', [11.218599757513008, 0.3781791648535976, nan])
> The last singular value should be something very close to 0 since the matrix
> is rank deficient.  When i use the result from getSolver() to solve a system, i end 
> up with a bunch of NaNs in the solution.  I assumed i would get back a least squares solution.
> Does this SVD implementation require that the matrix be full rank?  If so, then i would expect
> an exception to be thrown from the constructor or one of the methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.