1
$\begingroup$

I want to use it in Matlab or Java. Will these two languages be much slower for computing the algorithm compared to C, C++, in case efficiency is an important factor?

I'm aware of that there's a PROPACK and SVDPACK, etc. Seems quite old. What are some popular choices? Are there any paralleled versions existing? If there's no paralleled versions, I plan to make an appropriate sequential version to be parallelized (multiple threads). Parallelization is important for my project since it targets on big datasets. So I suppose I need to modify a chosen codes directly (multithreaded parallelization on the level of vector computation).

$\endgroup$
  • 1
    $\begingroup$ Basically any modern linear algebra library (Matlab, SciPy, whatever) will compute matrix operations by calling the same underlying open source highly optimized C and fortran codes (eg., BLAS, LAPACK, ARPACK), rather than computing it within the language. Matlab's eigs and svds commands use ARPACK for Arnoldi/Lanczos using the "eigs" and "svds" commands, and are quite efficient. I think a parallel extension of ARPACK is available, which you can call from your code in any language. $\endgroup$ – Nick Alger Nov 13 '14 at 19:36
  • $\begingroup$ Sometimes old is good. Why fix what ain't broke? (That said there are some functionality improvements I'd like to see in PROPACK; for instance, the ability to adaptively choose the number of singular values efficiently for thresholding purposes.) $\endgroup$ – Michael Grant Nov 13 '14 at 20:34
  • 1
    $\begingroup$ I know of MPI-based parallel libraries (again, SLEPc; also, pARPACK) for Lanczos-type methods for SVD. I think there's work being done on PETSc to try to better leverage thread-based parallelism, but I believe the MPI-based model is more prevalent when it comes to eigensolvers, and MATLAB is not good at that type of parallelism. Maybe you could do something with Java, although last I checked (around 2010, so things could have changed), the MPI bindings for Java weren't very good, so you'd probably be better off with Python, Fortran, C, C++, or even Julia. $\endgroup$ – Geoff Oxberry Nov 14 '14 at 3:06
2
$\begingroup$

So, in theory, you could use SLEPc's MATLAB interface. Doing so means you can't use any of the MPI-based parallelism, if it's anything like PETSc's MATLAB interface. There's a fair amount to install (PETSc, whatever packages you want to configure with PETSc, plus whatever eigensolvers you want to bundle with SLEPc), but it does give you a single interface from which you can use a variety of methods (e.g., thick restart Lanczos via TRLAN, implicitly restarted Arnoldi via ARPACK, Krylov-Schur), plus a large number of preconditioners.

$\endgroup$
0
$\begingroup$

There is a Java linear algebra benchmark that will give you some insight into how much slower Java is than native code.

Older results that compare Java and native code (Native code called from Java.)

Newer results that only compare the Java alternatives

This benchmark shows that it can be more than 10x faster to call native code from Java rather than implementing directly in Java, but this is With larger matrices and the more complex algorithms. Java performs well with simpler operations, and for small matrices the overhead when calling native code is too big.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.