This complements an earlier question on usable, fast C++ matrix libraries.

I've looked at the Java Matrix Benchmark, and it seems like the performance of java matrix libraries is all over the place. The Apache Commons Math library seems like a simple solution, but I'm curious for others recommendations.

Specifically, I'm curious which libraries are much easier/more performant than the others, and/or if Java library writers are better off just using JNI to call to an existing, better developed native matrix libraries. (Though that seems like it could make the code less portable or more of a hassle to setup.)


2 Answers 2


In general, you are almost always better off using the JNI if you are concerned about performance. A JNI interface to a fast BLAS is implemented by the Intel Math Kernel Library, which would be option if you are considering a cross-platform commercial offering. If you are looking for a fast open source offering, you might want to consider jblas, which tries to be multi-platform (with a few holes), and wraps ATLAS, a reasonably fast open source implementations of the BLAS.

Your mileage will vary based on the specific matrix operations you are performing and how big the matrices are.

Related Questions:


ND4J.org - it has tools to manipulate n-dimensional arrays on a distributed platform that uses native or GPUs. http://nd4j.org/, https://github.com/deeplearning4j/nd4j [Edit: ND4J, Deeplearning4j and other associated libraries were contributed to the Eclipse Foundation in October 2017. https://projects.eclipse.org/proposals/eclipse-deeplearning4j]

  • 2
    $\begingroup$ Welcome to SciComp! I noticed you've made commits to this repo. Since you're a contributor, could you please disclose your affiliation? Also, could you please elaborate a bit on performance? $\endgroup$ Dec 4, 2014 at 6:50
  • $\begingroup$ Hi Geoff - You bet. What kind of performance measures would be meaningful here? $\endgroup$
    – racknuf
    Dec 7, 2014 at 7:21
  • $\begingroup$ I'm not an expert here. Presumably, you'd want to measure performance similarly to something like MAGMA, cuBLAS, or ViennaCL. Someone else who does more GPU work want to chime in? $\endgroup$ Dec 8, 2014 at 9:15

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.