Singular value decomposition in Java

  • Thread starter Patricia Shanahan
  • Start date
P

Patricia Shanahan

In one of my programs, I use truncated singular value decomposition of a
matrix of doubles. In current tests, the matrix has about 20,000 rows
and 200 columns, but future tests may need more rows and more columns.
The matrix is sparse, and in Java is represented by a list of triples,
effectively (row, column, value). I can limit the result size by
truncating at a few dozen singular values.

My current quick hack solution is to write the triples to a temporary
file and exec Matlab to do the decomposition. All computers on which I
need to run this have Matlab installed. However, it is installed at
different places on different computers, so I use an environment
variable containing the Matlab executable path.

This works, and is quite quick even for the largest of my current test
cases. However, a pure Java solution might be cleaner and easier to manage.

JAMA, http://math.nist.gov/javanumerics/jama/, and Jampack,
ftp://math.nist.gov/pub/Jampack/Jampack/AboutJampack.html, both offer SVD.

Does anyone have any experience with them, especially for sparse matrix
truncated SVD? Recommendations on which to try first, if either? Other
options? Performance comparisons to Matlab?

Patricia
 
M

Mark Thornton

Patricia said:
In one of my programs, I use truncated singular value decomposition of a
matrix of doubles. In current tests, the matrix has about 20,000 rows
and 200 columns, but future tests may need more rows and more columns.
The matrix is sparse, and in Java is represented by a list of triples,
effectively (row, column, value). I can limit the result size by
truncating at a few dozen singular values.

My current quick hack solution is to write the triples to a temporary
file and exec Matlab to do the decomposition. All computers on which I
need to run this have Matlab installed. However, it is installed at
different places on different computers, so I use an environment
variable containing the Matlab executable path.

This works, and is quite quick even for the largest of my current test
cases. However, a pure Java solution might be cleaner and easier to manage.

JAMA, http://math.nist.gov/javanumerics/jama/, and Jampack,
ftp://math.nist.gov/pub/Jampack/Jampack/AboutJampack.html, both offer SVD.

Does anyone have any experience with them, especially for sparse matrix
truncated SVD? Recommendations on which to try first, if either? Other
options? Performance comparisons to Matlab?

Patricia

You might want to look at Colt as well, though its Linear Algebra is
adapted from Jama.

http://dsd.lbl.gov/~hoschek/colt/api/cern/colt/matrix/linalg/package-summary.html#Overview

Mark Thornton


http://dsd.lbl.gov/~hoschek/colt/api/cern/colt/matrix/linalg/package-summary.html#Overview
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top