Dev #127

Merged
altavir merged 214 commits from dev into master 2020-08-11 08:33:21 +03:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit c576e46020 - Show all commits

View File

@ -2,6 +2,7 @@ package scientifik.kmath.expressions
import scientifik.kmath.operations.Field import scientifik.kmath.operations.Field
import scientifik.kmath.operations.Space import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
open class AsmExpressionSpace<T>(private val space: Space<T>) : Space<AsmExpression<T>>, open class AsmExpressionSpace<T>(private val space: Space<T>) : Space<AsmExpression<T>>,
ExpressionSpace<T, AsmExpression<T>> { ExpressionSpace<T, AsmExpression<T>> {
@ -21,7 +22,7 @@ class AsmExpressionField<T>(private val field: Field<T>) : ExpressionField<T, As
override val one: AsmExpression<T> override val one: AsmExpression<T>
get() = const(this.field.one) get() = const(this.field.one)
override fun number(value: Number): AsmExpression<T> = const(field.run { one * value }) override fun number(value: Number): AsmExpression<T> = const(field { one * value })
override fun multiply(a: AsmExpression<T>, b: AsmExpression<T>): AsmExpression<T> = override fun multiply(a: AsmExpression<T>, b: AsmExpression<T>): AsmExpression<T> =
AsmProductExpression(field, a, b) AsmProductExpression(field, a, b)

View File

@ -3,6 +3,7 @@ package scientifik.kmath.expressions
import scientifik.kmath.operations.Field import scientifik.kmath.operations.Field
import scientifik.kmath.operations.Ring import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.Space import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
internal class VariableExpression<T>(val name: String, val default: T? = null) : Expression<T> { internal class VariableExpression<T>(val name: String, val default: T? = null) : Expression<T> {
override fun invoke(arguments: Map<String, T>): T = override fun invoke(arguments: Map<String, T>): T =
@ -57,7 +58,7 @@ open class FunctionalExpressionField<T>(
override val one: Expression<T> override val one: Expression<T>
get() = const(this.field.one) get() = const(this.field.one)
override fun number(value: Number): Expression<T> = const(field.run { one * value }) override fun number(value: Number): Expression<T> = const(field { one * value })
override fun multiply(a: Expression<T>, b: Expression<T>): Expression<T> = ProductExpression(field, a, b) override fun multiply(a: Expression<T>, b: Expression<T>): Expression<T> = ProductExpression(field, a, b)
override fun divide(a: Expression<T>, b: Expression<T>): Expression<T> = DivExpression(field, a, b) override fun divide(a: Expression<T>, b: Expression<T>): Expression<T> = DivExpression(field, a, b)
operator fun Expression<T>.times(arg: T): Expression<T> = this * const(arg) operator fun Expression<T>.times(arg: T): Expression<T> = this * const(arg)