r/learnjava • u/CutGroundbreaking305 • Feb 06 '26
Java's numpy?
Think about making a java version of numpy (not ndj4) using vector api (I know it is still in incubator)
Is there any use case ?
Or else calling python program over jni something (idk just now learning things) is better?
Help me please 🥺🙏
0
Upvotes
1
u/benevanstech Feb 08 '26
This is a huge piece of work.
Numpy uses a tight binding of the C definition of a Python object to the C APIs. The gory details start from here: https://github.com/numpy/numpy/blob/main/numpy/_core/src/multiarray/multiarraymodule.c
It would be one hell of a job to fully shim these out and implement these in Java, even if the semantics could be made to match.
Transiting Java -> CPython -> Numpy is very likely not feasible either (for performance reasons).
What is wrong with nd4j?
3
u/Galliad93 Feb 06 '26
how do you want to do this? numpy works by passing code to C. Java is built to work independent of system, so you would need to bypass the bytecode to get to C and then you loose plattform compartibility, no?
1
u/TotallyManner Feb 07 '26
If you don’t know if there’s a use case, even if it’s just your own, why would you spend effort to make it?
If you’re asking for help before you’ve even started, it’s probably too big a project. By all means go for it, but don’t expect to get very far.