kmath
kmath copied to clipboard
No floored division and modulo operations in IntRing, ShortRing, ByteRing and LongRing
There are no div and mod operations in integer typed rings. They have some use cases in basic arithmetics, so I think, integer algebra is inconsistent without them.
I'm not sure how faithful kmath about algebra abstractions. But rings don't have division. You'll get field if you want to add division.
Also while it's possible to define Field for word32/word64. Its division is completely different from usual rounded down division.
Those operations are not a part of Ring definition. We can add them if it is possible to implement them relying only on basic arithmetic operations. Otherwise, they could be added to short and int rings directly (but it does not make a lot of sense since ints and shorts already have them).
Those operations are not a part of
Ringdefinition. We can add them if it is possible to implement them relying only on basic arithmetic operations. Otherwise, they could be added to short and int rings directly (but it does not make a lot of sense since ints and shorts already have them).
It does. For example, for adv-expr Expressions API: binaryOperation("mod", a, b). Without algebra-supported operations, mod and div are simply unaccessible.
@Shimuuar Ring does not have division. It has only multiplication.
@Shimuuar Ring does not have division. It has only multiplication.
I suggest introducing new interface, something like:
interface DivisionWithRemainder<T> : RingOperations<T> {
fun mod(T, T): T
fun div(T, T): T
}