commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dieter Vandenbussche (JIRA)" <>
Subject [jira] Commented: (MATH-320) NaN singular value from SVD
Date Wed, 11 Nov 2009 13:37:39 GMT


Dieter Vandenbussche commented on MATH-320:

Yes, making that change fixes the singular values, printing the singular values now gives

array('d', [11.218599757513008, 0.3781791648535976, 0.0])

The unittests for the project still pass as well.

However, now the solve fails with a SinularMatrixException

Traceback (most recent call last):
  File "", line 14, in <module>
    soln = solver.solve([5.0, 6.0,7.0])
	at org.apache.commons.math.linear.SingularValueDecompositionImpl$Solver.solve(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(

org.apache.commons.math.linear.SingularMatrixException: org.apache.commons.math.linear.SingularMatrixException:
matrix is singular

This confuses me, i guess i'm assuming incorrectly that if the solve method can solve in the
least squares sense, then it should be
able to handle singular matrices.  Is that just a restriction on the current solve methods
and if so, are there plans to relax that restriction?

thanks very much for your time

> NaN singular value from SVD
> ---------------------------
>                 Key: MATH-320
>                 URL:
>             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
> Does this SVD implementation require that the matrix be full rank?  If so, then i would
> 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.

View raw message