Fork me on GitHub

by mikiobraun

Linear Algebra for Java (Current Version: V1.0.2, released February 26, 2010)

jblas is a fast linear algebra library for Java. jblas is based on BLAS and LAPACK, the de-facto industry standard for matrix computations, and uses state-of-the-art implementations like ATLAS for all its computational routines, making jBLAS very fast.

jblas can is essentially a light-wight wrapper around the BLAS and LAPACK routines. These packages have originated in the Fortran community which explains their often archaic API. On the other hand modern implementations are hard to beat performance wise. jblas aims to make this functionality available to Java programmers such that they do not have to worry about writing JNI interfaces and calling conventions of Fortran code.

jblas depends on an implementation of the LAPACK and BLAS routines. Currently it is tested with ATLAS (http://math-atlas.sourceforge.net/) and BLAS/LAPACK (http://www.netlib.org/lapack)

Getting Started

There exists a prepackaged jar-file with prebuild native libraries. Currently, Linux (i386/amd64), Mac OS X (i386/x86_64) and Windows (i386) are covered. Currently, no support for amd64 on Windows. Read here why. But you can use jblas with a 32bit JVM also on a 64bit Windows machine.

jblas is hosted on github.

For instructions on compiling everything yourself, see INSTALL.

If you download the prepackaged file, you can run it with java -server -jar jblas-1.0.1.jar

to check the basic install and get some performance number. On my laptop (Linux, i386, Core2Duo 2Ghz), I get the following:
Simple benchmark for jblas

Running sanity benchmarks.

checking vector addition... ok
-- org.jblas CONFIG BLAS native library not found in path. Copying native library from the archive. Consider installing the library somewhere in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH).
-- org.jblas CONFIG Loading libjblas.so from /lib/static/Linux/i386/libjblas.so.
checking matrix multiplication... ok
checking existence of dsyev...... ok
checking XERBLA... ok
Sanity checks passed.

Each benchmark will take about 5 seconds...

Running benchmark "Java matrix multiplication, double precision".
n = 10   :  424.4 MFLOPS (1061118 iterations in 5.0 seconds)
n = 100  : 1272.6 MFLOPS (3182 iterations in 5.0 seconds)
n = 1000 :  928.5 MFLOPS (3 iterations in 6.5 seconds)

Running benchmark "Java matrix multiplication, single precision".
n = 10   :  445.0 MFLOPS (1112397 iterations in 5.0 seconds)
n = 100  : 1273.0 MFLOPS (3183 iterations in 5.0 seconds)
n = 1000 : 1330.9 MFLOPS (4 iterations in 6.0 seconds)

Running benchmark "ATLAS matrix multiplication, double precision".
n = 10   :  428.2 MFLOPS (1070428 iterations in 5.0 seconds)
n = 100  : 3293.9 MFLOPS (8235 iterations in 5.0 seconds)
n = 1000 : 5383.2 MFLOPS (14 iterations in 5.2 seconds)

Running benchmark "ATLAS matrix multiplication, single precision".
n = 10   :  465.2 MFLOPS (1162905 iterations in 5.0 seconds)
n = 100  : 5997.3 MFLOPS (14994 iterations in 5.0 seconds)
n = 1000 : 9186.6 MFLOPS (23 iterations in 5.0 seconds)
    

Other sources of information:

Documentation

A good starting point are the API Documentations.

If you have more questions, go to the jblas-users mailing list .

Some info has been collected in the jblas wiki.

Finally, you might want to check out the issue tracker to check whether a bug is already known.

License

BSD Revised (see COPYING)

Authors

Mikio L. Braun, Johannes Schaback, Matthias L. Jugel

Getting the Sources

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/mikiobraun/jblas