weyns49570 / efficient-java-matrix-library

Automatically exported from code.google.com/p/efficient-java-matrix-library
0 stars 0 forks source link

Nullity() and nullspace() #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compute the SVD of matrix [ 1 0 0 ]
2. Nullity()

What is the expected output? What do you see instead?
Nullity = 0 . Expected output  = 2.
Verified using wolfram alpha with input nullity {{1,0,0}}

What version of the product are you using? On what operating system?
Linux.

Please provide any additional information below.
The rank is one , so I think nullspace() should be 3*2 matrix , but I only get 
a 3*1 matrix.

Original issue reported on code.google.com by arnavku...@gmail.com on 9 May 2012 at 2:01

GoogleCodeExporter commented 9 years ago
Yep it looks like EJML is doing something in a non standard way.  It appears to 
be computing the SVD correctly, but the way to determines the nullity/nullspace 
is off.  Below is some sample code I used to reproduce the problem.

public class FooBar {
    public static void main( String args[] ) {
        SimpleMatrix m = new SimpleMatrix(1,3,true,1,0,0);

        SimpleSVD svd = m.svd();

        System.out.println("SVD decomposition");
        svd.getU().print();
        svd.getW().print();
        svd.getV().print();

        int nullity = svd.nullity();
        SimpleMatrix nullSpace = svd.nullSpace();

        System.out.println("nullity = "+nullity);
        nullSpace.print();
    }
}

Original comment by peter.ab...@gmail.com on 14 May 2012 at 7:40

GoogleCodeExporter commented 9 years ago
A fix has been committed to the SVN repository.
- Nullity did not handle wide matrices correctly
- Null-Space was a bug/non-standard implementation of the null-space
- Unit tests have been added/updated.

If you have a change can you check out the code and let me know if the fix 
worked?  Thanks for reporting the bugs.

Original comment by peter.ab...@gmail.com on 16 May 2012 at 2:47

GoogleCodeExporter commented 9 years ago
Closing ticket.  Assuming the fix works

Original comment by peter.ab...@gmail.com on 22 May 2012 at 2:07