Pushed 0.0.3 update to kmath. It brings a major ch...
# mathematics
a
Pushed 0.0.3 update to kmath. It brings a major change in file structure. Algebras are now cleanly separated from algebra elements, also a lot of work on understanding performance issues of nd-operations and a little bit of documentation (https://github.com/altavir/kmath/blob/dev/doc/algebra.md , more coming tomorrow). The key point for performance optimization is this one: https://github.com/altavir/kmath/blob/9da1a8c3e39a59549885a99418ae4fa9e37ca528/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/RealNDField.kt#L12 With this, the total performance of nd-operation is 5-10 % better than numpy (probably due to more efficient memory cleanup). Sadly, specialization for other primitives requires replicating this class and changing this method (other method must be kept because otherwise they do not benefit from inlining. The performance for non-specialized class is about 4-5 times worse. Also, you can look into this class: https://github.com/altavir/kmath/blob/dev/kmath-core/src/jvmMain/kotlin/scientifik/kmath/structures/ComplexBufferSpec.kt It allows to add new type of objects to both linear buffers and nd-structures without any boxing overhead. Boxing will be involved on read operations (you read values as primitives, but then combine them into object), but if needed it also could be eliminated with inline classes. The same could be easily done for any structure constructed from primitive. Together with field class https://github.com/altavir/kmath/blob/dev/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/Complex.kt it covers all possible uses for complex numbers without additional boilerplate and code generation.
0️⃣ 1
3️⃣ 1
👍 1