diff --git a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt index 8147bcd5c..38ed00605 100644 --- a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt +++ b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt @@ -4,8 +4,9 @@ import scientifik.kmath.operations.Field import scientifik.kmath.operations.Space import scientifik.kmath.operations.invoke -open class AsmExpressionSpace(private val space: Space) : Space>, - ExpressionSpace> { +open class AsmExpressionSpace(private val space: Space) : + Space>, + ExpressionContext> { override val zero: AsmExpression = AsmConstantExpression(space.zero) override fun const(value: T): AsmExpression = AsmConstantExpression(value) override fun variable(name: String, default: T?): AsmExpression = AsmVariableExpression(name, default) @@ -17,12 +18,14 @@ open class AsmExpressionSpace(private val space: Space) : Space): AsmExpression = arg - this } -class AsmExpressionField(private val field: Field) : ExpressionField>, +class AsmExpressionField(private val field: Field) : + ExpressionContext>, + Field>, AsmExpressionSpace(field) { override val one: AsmExpression get() = const(this.field.one) - override fun number(value: Number): AsmExpression = const(field { one * value }) + fun number(value: Number): AsmExpression = const(field { one * value }) override fun multiply(a: AsmExpression, b: AsmExpression): AsmExpression = AsmProductExpression(field, a, b) diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt index 4f38e3a71..97002f664 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt @@ -39,7 +39,7 @@ internal class DivExpession(val context: Field, val expr: Expression, v open class FunctionalExpressionSpace( val space: Space -) : Space>, ExpressionContext> { +) : Space>, ExpressionContext> { override val zero: Expression = ConstantExpression(space.zero) @@ -61,12 +61,12 @@ open class FunctionalExpressionSpace( open class FunctionalExpressionField( val field: Field -) : Field>, ExpressionContext>, FunctionalExpressionSpace(field) { +) : Field>, ExpressionContext>, FunctionalExpressionSpace(field) { override val one: Expression get() = const(this.field.one) - fun const(value: Double): Expression = const(field.run { one*value}) + fun number(value: Number): Expression = const(field.run { one * value }) override fun multiply(a: Expression, b: Expression): Expression = ProductExpression(field, a, b)