1

I am looking for a Java library that closely mirrors matlab's Matrix functions and possibly other functions in the areas of polynomial interpolation, etc.

If such a library does not exist I was toying with the idea of building my own but using an existing Matrix or scientific computing library to do the heavy lifting - if I were to do that which libraries would be candidates to serve as backends for such an effort

user1172468
  • 5,306
  • 6
  • 35
  • 62

4 Answers4

2

Eigen, one of the most used (and fastest) library for matrix computation in C++, has a java wrapper: jeigen.

It allows one to manipulate full and sparse matrices and make operations one them. It can be also worth trying.

Acorbe
  • 8,367
  • 5
  • 37
  • 66
  • Thanks Acorbe, one of the things I was considering is having multiple backends. that one could plugin. – user1172468 Apr 06 '13 at 20:16
  • But Jeigen does not implement a sparse solver. [I had to do it myself](https://stackoverflow.com/questions/17046585/cholmod-in-java/30526005#30526005). – Z boson May 29 '15 at 09:38
1

Check out the following resources/packages

  1. http://math.nist.gov/javanumerics/jama/

  2. http://www.jscience.org/

prashant
  • 1,805
  • 12
  • 19
  • Thanks @prashant, I tried jama a while back and left feeling that it was sufficiently polished. Would you agree with my assessment or do you think I misjudged it. Thanks. – user1172468 Apr 06 '13 at 20:11
  • 1
    I think for matrices it is arguably the best package out there yet(in java) – prashant Apr 06 '13 at 20:12
1

Try to look at la4j (Linear Algebra for Java). It supports dense matrices as well as sparse ones. Here is just a brief example of using functional features of la4j:

// reads the dense matrix from the CSV file
Matrix a = new Basic2DMatrix(Mattrices.asSymbolSeparatedSource("matrix.csv", ","));

// calculates the sum of all elements of the matrix 'a'
double sum = a.fold(Matrices.asSumAccumulator(0));

// creates a new matrix 'b', that contains elements of matrix 'a' multiplied by '2'.
Matrix b = a.transform(Matrices.asMulFunction(2));

The best way to get the last version of la4j - visit it's GitHub page.

Vladimir Kostyukov
  • 2,492
  • 3
  • 21
  • 30
1

I use the Colt library for matrix operations.

See in: http://acs.lbl.gov/software/colt/api/index.html

I think it's really good and easy to use and is better than Apache Commons-Math and EJML that I have already tried.

I suggest you try all of the libraries mentioned and choose the one that is closer to your needs.

Konstantinos_S
  • 65
  • 2
  • 10