SciProgCentre/kmath

Tensor dot logic seems to be overcomplicated

altavir opened this issue · 0 comments

It seems like https://github.com/mipt-npm/kmath/blob/47aeb36979d3501def28d920a86cf60916d5166b/kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/api/TensorAlgebra.kt#L228 is very hard to implement properly for different tensor algebras. The logic of automatic broadcasting and dimension inference is too hard. All other libraries seem to require explicit axes.

I suggest adding explicit axis numbers as an argument so it would be easy to add different implementations and then add an extension or default function that would automatically compute the axis. Or you can add this to broadcast algebra.