Kotlin - the computational and math related libraries?


#1

I’ve shifted to Kotlin from Java. The Java is indeed a legacy.
As Python has many libraries to compute and do math stuff flawlessly, Will kotlin get any extended math/computation library ( containing some permutations-combinations, itertools and stuff like that matrix operation-numpy etc)? Any plans in the future release?


#2

You can use java libraries as is, but I agree that it would be good to have dedicated mathematics library in kotlin. I’ve started a project on this: https://github.com/altavir/kmath, but currently do not have time to develop it. Please fill free to open feature requests and contribute.

I think that it is possible to make kotlin almost as convenient as numpy without loosing type safety.


#3

Cool. @darksnake . I saw your library and it’s very well implemented. Still I got one question about the complexities and runtime like, is it okay to run the computational programs on the JVM based platform? Will it not affect in performance of kotlin or it’ll be better than java?


#4

One thing you should understand, that Java slowness when it comes to computation is mostly a myth. Since Java 5, the performance of JVM code in long running tasks (not counting JVM heating time) rivals the performance of native code (a lot of tests about it, it is even better in handling complicated object structures). Native code wins, when it comes to platform-specific optimization, but who really does that? Graal reports even better performance, but it remains to be seen.

Kotlin does not add much on top of plain old java, when it comes to performance, but allows some tricks, which are hard to do in java, like automatic handling of primitives to avoid boxing.

The final thing. You probably noticed that the library is implemented as a multi-platform build. For now we are targeting only JVM, but later one could add JS and native back-ends to work on appropriate platforms.