forked from kscience/kmath
Made IntModulo implement ScaleOperations.
This commit is contained in:
parent
5bc627f1d4
commit
f7d159bc03
@ -8,6 +8,7 @@
|
|||||||
package space.kscience.kmath.functions.testUtils
|
package space.kscience.kmath.functions.testUtils
|
||||||
|
|
||||||
import space.kscience.kmath.operations.Ring
|
import space.kscience.kmath.operations.Ring
|
||||||
|
import space.kscience.kmath.operations.ScaleOperations
|
||||||
|
|
||||||
|
|
||||||
public class IntModulo {
|
public class IntModulo {
|
||||||
@ -108,7 +109,7 @@ public class IntModulo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE")
|
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE")
|
||||||
public class IntModuloRing : Ring<IntModulo> {
|
public class IntModuloRing : Ring<IntModulo>, ScaleOperations<IntModulo> {
|
||||||
|
|
||||||
public val modulus: Int
|
public val modulus: Int
|
||||||
|
|
||||||
@ -130,4 +131,6 @@ public class IntModuloRing : Ring<IntModulo> {
|
|||||||
override inline fun IntModulo.minus(arg: IntModulo): IntModulo = this - arg
|
override inline fun IntModulo.minus(arg: IntModulo): IntModulo = this - arg
|
||||||
override inline fun IntModulo.times(arg: IntModulo): IntModulo = this * arg
|
override inline fun IntModulo.times(arg: IntModulo): IntModulo = this * arg
|
||||||
public inline fun IntModulo.div(arg: IntModulo): IntModulo = this / arg
|
public inline fun IntModulo.div(arg: IntModulo): IntModulo = this / arg
|
||||||
|
|
||||||
|
override fun scale(a: IntModulo, value: Double): IntModulo = a * value.toInt()
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user