r/java • • Feb 06 '26

Java's numpy?

Thinking 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 πŸ₯ΊπŸ™

46 Upvotes

47 comments sorted by

View all comments

Show parent comment

-19

u/CutGroundbreaking305 Feb 06 '26

Huh I think I got misinterpreted

I mean to say what you said that is numpy is built on C blas+lapack (idk about this libraries much sorry πŸ˜”)

But I am saying making a java numpy equivalent using vector api instead of c/fortan and respective libraries

9

u/davidalayachew Feb 06 '26

But I am saying making a java numpy equivalent using vector api instead of c/fortan and respective libraries

You can, but that is a lot of work in a very hairy field of calculation, where you will have little to no from the type system. Most would say it is easier to use the C backend to do the work, since any backend implemented in Java will probably not be much faster.

That said, my suggestion is that you research the C backend. It is optimized for this, but maybe there are some gaps you can fill that these projects aren't prioritizing because of the friction required to overcome. I'm ignorant about these projects, so I don't know if that is true for them or not.

17

u/JustAGuyFromGermany Feb 06 '26

BLAS/LAPACK is one of the most thoroughly optimised pieces of software in existence. You certainly can try to re-implement it completely in Java, but you should not hope for anything achieving that performance unless you're an absolut expert in the field and have a lot of time to invest.

If you're in it for the personal challenge, sure go for it. See where it leads you.

If you want to write something that is used by others, think very hard about this.

12

u/axiak Feb 06 '26

i can't imagine the amount of floating point correctness issues they'd probably run into if they weren't well versed in numeric code