From c576e46020b9a10ce2b6d3769032cc57e6522bbc Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Mon, 8 Jun 2020 14:46:00 +0700 Subject: [PATCH] Minor refactor --- .../kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt | 3 ++- .../scientifik/kmath/expressions/FunctionalExpressions.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 da788372b..8147bcd5c 100644 --- a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt +++ b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressionSpaces.kt @@ -2,6 +2,7 @@ package scientifik.kmath.expressions import scientifik.kmath.operations.Field import scientifik.kmath.operations.Space +import scientifik.kmath.operations.invoke open class AsmExpressionSpace(private val space: Space) : Space>, ExpressionSpace> { @@ -21,7 +22,7 @@ class AsmExpressionField(private val field: Field) : ExpressionField get() = const(this.field.one) - override fun number(value: Number): AsmExpression = const(field.run { one * value }) + override 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 dbc2eac1e..0304a665f 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/expressions/FunctionalExpressions.kt @@ -3,6 +3,7 @@ package scientifik.kmath.expressions import scientifik.kmath.operations.Field import scientifik.kmath.operations.Ring import scientifik.kmath.operations.Space +import scientifik.kmath.operations.invoke internal class VariableExpression(val name: String, val default: T? = null) : Expression { override fun invoke(arguments: Map): T = @@ -57,7 +58,7 @@ open class FunctionalExpressionField( override val one: Expression get() = const(this.field.one) - override fun number(value: Number): Expression = const(field.run { one * value }) + override fun number(value: Number): Expression = const(field { one * value }) override fun multiply(a: Expression, b: Expression): Expression = ProductExpression(field, a, b) override fun divide(a: Expression, b: Expression): Expression = DivExpression(field, a, b) operator fun Expression.times(arg: T): Expression = this * const(arg)