https://kotlinlang.org logo
i

Iaroslav Postovalov

12/08/2020, 8:41 AM
Just sent a PR to KMath that replaces syntax of dynamic calls of algebraic operations from
algebra.binaryOperation("+", 1, 1)
to
algebra.binaryOperation("+")(1, 1)
. This feature also affects ASM code generation so generated classes store functional objects returned by
*aryOperation("...")
methods instead of storing algebraic structures.
a

altavir

12/08/2020, 10:14 AM
Ther was a bit of discussion about it. Because @Iaroslav Postovalov insists that algebra functions should be exposed as lambdas, not like function calls. We are talking about this line: https://github.com/mipt-npm/kmath/blob/f001389f4cd6ad1cd9f040d5d939cda9122476c0/km[…]core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt. I do not fully agree with this solution since it is not good from performance reasons (additional boxing could not be avoided) and the signature is more complex. The discussion would be welcome
3 Views