Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The V^t matrix returned by SVD.svd using COLT is not transposed #59

Open
GoogleCodeExporter opened this issue Dec 1, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

Here there's a small snippet:

    public void testCompareSVDResults() {
        int m = 5, n = 4;

        Random generator = new Random();
        Matrix mat = new ArrayMatrix(m, n);

        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < n; ++j) {
                mat.set(i, j, Math.abs(generator.nextDouble()) % 100);
            }
        }

        List<SVD.Algorithm> algorithms = new LinkedList<SVD.Algorithm>();

        algorithms.add(SVD.Algorithm.COLT);
        algorithms.add(SVD.Algorithm.JAMA);
        algorithms.add(SVD.Algorithm.SVDLIBJ);

        for (Algorithm algorithm : algorithms) {
            System.out.println("Algorithm is: " + algorithm);

            Matrix[] svd = SVD.svd(mat, algorithm, Math.min(m, n));
            Matrix vt = svd[2];

            System.out.println("V^t is:");
            System.out.println(toString(vt));
        }
    }

What is the expected output? What do you see instead?

Algorithm is: COLT
V^t is:
[[0.537,0.522,0.351,0.562]
[0.437,0.220,-0.869,-0.078]
[0.624,-0.130,0.343,-0.690]
[0.363,-0.814,-0.065,0.449]
]
Algorithm is: JAMA
V^t is:
[[0.537,0.437,0.624,0.363]
[0.522,0.220,-0.130,-0.814]
[0.351,-0.869,0.343,-0.065]
[0.562,-0.078,-0.690,0.449]
]
Algorithm is: SVDLIBJ
V^t is:
[[0.537,0.437,0.624,0.363]
[0.522,0.220,-0.130,-0.814]
[-0.351,0.869,-0.343,0.065]
[-0.562,0.078,0.690,-0.449]
]

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

I'm on Debian GNU/Linux, using a version obtained from the SVN repository on 14 
Jul 2010

Original issue reported on code.google.com by [email protected] on 15 Jul 2010 at 10:36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant