https://kotlinlang.org logo
Title
a

altavir

12/26/2018, 7:51 AM
Hello guys, yesterday we had a talk with @elizarov about development of scientific/mathematics libraries for kotlin and he recommended to start a discussion here since we do not have dedicated channel for that. My team is working on a bunch of scientific libraries (the application is mostly physics, but they should be universal). Currently we are working on a basic mathematics (https://github.com/altavir/kmath/tree/dev). I personally think that Kotlin has a great future as a language for science so, it would be good to create a robust scientific community around. So, speaking about math, in
kmath
we use rather experimental approach using unique context oriented kotlin features rather than copying details from python. I studied https://github.com/kyonifer/koma and there are a lot of good things there and a lot of work done. I think, that we need that library or something similar for people coming form Python, but sadly it does not suite more advanced mathematics use that we need. Python style is probably good for data science, but the type system is too crude do something complicated. My proposition is to devise a common mathematics interfaces and specifications for kotlin/multiplatform and then ensure that all implementations follow those interfaces. The same goes for plotting (we are currently working on plotting interfaces similar to matplotlib in functionality, but with modern declarative api).
👍 5
t

thomasnield

12/26/2018, 1:21 PM
You are definitely going to want to talk to @kyonifer as he's already been trying to extract common interfaces with Koma and backing them with multiplatform implementions. There are a couple of scientific JVM libraries already, like Apache Commons Math, ND4J, and ojAlgo. But Koma is the most concerted effort to support multiplatform Kotlin scientific computing.
a

altavir

12/26/2018, 1:24 PM
This is the plan. Frankly speaking, In my opinion. koma takes too many bad things from Python. But we need to discuss it, because everyone have different background.
v

ValV

12/26/2018, 2:22 PM
In my view, it would be interesting, if you introduce your own way
a

altavir

12/26/2018, 2:34 PM
The problem with koma is that it follows numpy almost precisely. And numpy was designed with python defficiencies in mind. What we (I mean our group) need is a flexible type system and ability to do some advanced things like expressions and lazily evaluated objects. Current kmath (maybe it is more correct to rename it to kontext-math) follows the tradition started with commons-math, namely using algebra abstractions as types. It is in early development stage and maybe looks overcomplicated. Today I wrote two small texts for documentation: https://github.com/altavir/kmath/tree/dev/doc, maybe you could get an idea from them.
👍 1
What I currently don't have is an implementation using existing libraries, so I will look into koma implementation.
b

breandan

12/26/2018, 4:40 PM
I really like the idea of defining these structures using algebra, recently started playing with a similar project and feel these kinda of abstractions would be useful for more general-purpose mathematics libraries: https://github.com/breandan/algebraik
a

altavir

12/26/2018, 4:43 PM
We should probably think together. I think that the starting point is to somehow create a base of use-cases. Maybe create a separate repository for keep-like proposals and discussions?
b

breandan

12/26/2018, 5:01 PM
Maybe this discussion is more appropriate for #mathematics. Re: Collaboration, sure! I'm happy to be involved in the discussion. I think a Kotlin-native mathematics library should ideally leverage the type system to its full extent. There are some existing libraries for building numerical abstractions, although I'm not about the performance tradeoffs here (ex. https://github.com/non/spire). But you certainly could build such a library from first principles (Group, Ring, Field, etc.) using lazy evaluation and functional programming...
a

altavir

12/26/2018, 5:02 PM
OK, let's go there .I did not know, it exists.
k

kyonifer

12/26/2018, 6:52 PM
@altavir More interest in scientific computing is always good, I'll be interested to see what you come up with. One thing to note is that koma has building out an apache commons-math set of capability on the roadmap. I have parts of the optimization and least squares packages ported on top of koma (unpushed). However, the current goal is to finish off a complete N-D tensor on all platforms.
b

bjonnh

12/26/2018, 9:20 PM
@altavir There is #science too