The OP is from 2011. So as of end of 2015 I would like mention that there is a new kid in town which claims to be numpy for java -> nd4j]. The nice thing is that nd4j is an abstraction layer on top of different libraries like blas. Depending on the size of your matrices there are underlying implementations twice as fast as numpy or jblas. And your code is real platform independent.
Answer from KIC on Stack OverflowThe OP is from 2011. So as of end of 2015 I would like mention that there is a new kid in town which claims to be numpy for java -> nd4j]. The nice thing is that nd4j is an abstraction layer on top of different libraries like blas. Depending on the size of your matrices there are underlying implementations twice as fast as numpy or jblas. And your code is real platform independent.
The library Vectorz (https://github.com/mikera/vectorz) offers a fully featured NDArray that is broadly equivalent in functionality to Numpy's NDArray, i.e. it offers the fullowing features:
- Arbitrary N-dimensional arrays of numeric values (in this case, Java doubles)
- Lightweight views using strided access for efficient slicing
- A broad range of mathematical operations with effiecient implementations
It's also very fast: it is much faster then NumPy for most operations, although NumPy may still be faster for certain large matrix operations because it uses the native BLAS libraries to accelerate these.
Here's the NDArray class itself:
https://github.com/mikera/vectorz/blob/develop/src/main/java/mikera/arrayz/NDArray.java
Disclaimer: I'm the author of Vectorz
NDArray library
NumPy equivalent for Java?
I'm looking for a NDArray library in java that has many features similar to numpy. I mostly need element-wise operations, but also matrix manipulations like stack, flatting, concating etc. I need it to have very high performance as I will have thousands of calculations per second. My matrices will be about 500x500 (at average) So far I've tried many pure java libraries like EJML and commons math, but they lack many features. I also tried to use nd4j, but I'm getting a lot of memory leaks and very little support from their community.
Any suggestions? :)
Is the a NumPy equivalent for Java?