From b89a05347cd4d06a4e1aa6f035a39b2c368e2b98 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Sun, 20 Sep 2020 19:26:44 +0700 Subject: [PATCH] Hotfix some problems with MstAlgebra.kt --- .../kotlin/scientifik/kmath/ast/MstAlgebra.kt | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/kmath-ast/src/commonMain/kotlin/scientifik/kmath/ast/MstAlgebra.kt b/kmath-ast/src/commonMain/kotlin/scientifik/kmath/ast/MstAlgebra.kt index 23deae24b..29b76f7ca 100644 --- a/kmath-ast/src/commonMain/kotlin/scientifik/kmath/ast/MstAlgebra.kt +++ b/kmath-ast/src/commonMain/kotlin/scientifik/kmath/ast/MstAlgebra.kt @@ -38,7 +38,9 @@ object MstSpace : Space, NumericAlgebra { * [Ring] over [MST] nodes. */ object MstRing : Ring, NumericAlgebra { - override val zero: MST = number(0.0) + override val zero: MST + get() = MstSpace.zero + override val one: MST = number(1.0) override fun number(value: Number): MST = MstSpace.number(value) @@ -59,8 +61,11 @@ object MstRing : Ring, NumericAlgebra { * [Field] over [MST] nodes. */ object MstField : Field { - override val zero: MST = number(0.0) - override val one: MST = number(1.0) + override val zero: MST + get() = MstRing.zero + + override val one: MST + get() = MstRing.one override fun symbol(value: String): MST = MstRing.symbol(value) override fun number(value: Number): MST = MstRing.number(value) @@ -79,14 +84,25 @@ object MstField : Field { * [ExtendedField] over [MST] nodes. */ object MstExtendedField : ExtendedField { - override val zero: MST = number(0.0) - override val one: MST = number(1.0) + override val zero: MST + get() = MstField.zero + override val one: MST + get() = MstField.one + + override fun symbol(value: String): MST = MstField.symbol(value) override fun sin(arg: MST): MST = unaryOperation(TrigonometricOperations.SIN_OPERATION, arg) override fun cos(arg: MST): MST = unaryOperation(TrigonometricOperations.COS_OPERATION, arg) + override fun tan(arg: MST): MST = unaryOperation(TrigonometricOperations.TAN_OPERATION, arg) override fun asin(arg: MST): MST = unaryOperation(TrigonometricOperations.ASIN_OPERATION, arg) override fun acos(arg: MST): MST = unaryOperation(TrigonometricOperations.ACOS_OPERATION, arg) override fun atan(arg: MST): MST = unaryOperation(TrigonometricOperations.ATAN_OPERATION, arg) + override fun sinh(arg: MST): MST = unaryOperation(HyperbolicOperations.SINH_OPERATION, arg) + override fun cosh(arg: MST): MST = unaryOperation(HyperbolicOperations.COSH_OPERATION, arg) + override fun tanh(arg: MST): MST = unaryOperation(HyperbolicOperations.TANH_OPERATION, arg) + override fun asinh(arg: MST): MST = unaryOperation(HyperbolicOperations.ASINH_OPERATION, arg) + override fun acosh(arg: MST): MST = unaryOperation(HyperbolicOperations.ACOSH_OPERATION, arg) + override fun atanh(arg: MST): MST = unaryOperation(HyperbolicOperations.ATANH_OPERATION, arg) override fun add(a: MST, b: MST): MST = MstField.add(a, b) override fun multiply(a: MST, k: Number): MST = MstField.multiply(a, k) override fun multiply(a: MST, b: MST): MST = MstField.multiply(a, b)