1

I'm looking for a fast library to compute SVD (Singular Value Decomposition) in Java. I have already tried some libs I've found and I've done some benchmark (the values show the average time of my benchmark run...) It's not really a valid benchmark, but it was tested on the data I need to process, so enough for me..

  1. Jama - 152 102ms
  2. ujmp - 156 603ms
  3. Commons Math - 183 877ms
  4. colt - 203 866ms
  5. jblas - way slower...

I don't really expect to find something faster than Jama, but I can give it a try... Can you recommend me some other library? Thanks!

edit: I have found a nice page with benchmark of linear algebra libs, so I guess that concludes this question... EJML looks promising...

Jaa-c
  • 5,017
  • 4
  • 34
  • 64
  • What magic are you hoping for? Why do you think you'll be able to improve by an order of magnitude using another library? – duffymo Apr 10 '12 at 00:36
  • I'm not hoping for magic, I'm just trying to find the fastest available solution... – Jaa-c Apr 10 '12 at 00:44
  • I'm curious myself. I'd throw in http://arma.sourceforge.net/ for comparison--supposed to be one of the fastest C++ libs. If you find something that is comparable to that, then I'd say you're in the "good enough" category. But make sure you warm up your JVM before the benchmark. The JIT (re-)compilation can really speed things up. – ɲeuroburɳ Apr 10 '12 at 02:59
  • @rcompton: I only need the V matrix... – Jaa-c Apr 10 '12 at 11:26
  • 1
    But the whole V? Not just the vectors corresponding to a few of the singular values? – dranxo Apr 10 '12 at 12:27
  • @rcompton: I decompose matrix nx3, which gives me 3x3 V matrix and I need the right column (3 values). TBH I don't really understand how it works :(, I just know how to use it... – Jaa-c Apr 10 '12 at 12:37
  • 1
    Ah ok, since it's nx3 you'll probably need the full SVD. I was thinking you could use something like http://en.wikipedia.org/wiki/Singular_value_decomposition#Thin_SVD – dranxo Apr 10 '12 at 23:15
  • Yea, I get what you meant now, but that's not what I could use... Thanks anyway! – Jaa-c Apr 11 '12 at 00:31
  • I discussed similar topic with my colleague. He recommended mi try a gpu oriented languages - try "svd in gpu" on Google. I found, that Oracle prepare gpu support to java. – Máťa - Stitod.cz Jul 17 '14 at 12:45

2 Answers2

2

Have you tried LAPACK? See here for more: http://en.wikipedia.org/wiki/LAPACK

Since you want native java library try netlib: http://code.google.com/p/netlib-java/ .

ElKamina
  • 7,747
  • 28
  • 43
  • Thanks, I haven't known that, but unfortunately, I have to use pure Java and this uses some C++ libs... – Jaa-c Apr 10 '12 at 11:24
2

I have found this page with benchmark of linear algebra libs, so I guess that concludes this question... EJML looks promising...I have found a nice page with benchmark of linear algebra libs, so I guess that concludes this question... EJML looks really good, it works almost 2x faster than jama on my data...

Jaa-c
  • 5,017
  • 4
  • 34
  • 64