Dev #127

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

View File

@ -4,8 +4,9 @@ import scientifik.kmath.operations.Field
import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
open class AsmExpressionSpace<T>(private val space: Space<T>) : Space<AsmExpression<T>>,
ExpressionSpace<T, AsmExpression<T>> {
open class AsmExpressionSpace<T>(private val space: Space<T>) :
Space<AsmExpression<T>>,
ExpressionContext<T, AsmExpression<T>> {
override val zero: AsmExpression<T> = AsmConstantExpression(space.zero)
override fun const(value: T): AsmExpression<T> = AsmConstantExpression(value)
override fun variable(name: String, default: T?): AsmExpression<T> = AsmVariableExpression(name, default)
@ -17,12 +18,14 @@ open class AsmExpressionSpace<T>(private val space: Space<T>) : Space<AsmExpress
operator fun T.minus(arg: AsmExpression<T>): AsmExpression<T> = arg - this
}
class AsmExpressionField<T>(private val field: Field<T>) : ExpressionField<T, AsmExpression<T>>,
class AsmExpressionField<T>(private val field: Field<T>) :
ExpressionContext<T, AsmExpression<T>>,
Field<AsmExpression<T>>,
AsmExpressionSpace<T>(field) {
override val one: AsmExpression<T>
get() = const(this.field.one)
override fun number(value: Number): AsmExpression<T> = const(field { one * value })
fun number(value: Number): AsmExpression<T> = const(field { one * value })
override fun multiply(a: AsmExpression<T>, b: AsmExpression<T>): AsmExpression<T> =
AsmProductExpression(field, a, b)

View File

@ -66,7 +66,7 @@ open class FunctionalExpressionField<T>(
override val one: Expression<T>
get() = const(this.field.one)
fun const(value: Double): Expression<T> = const(field.run { one*value})
fun number(value: Number): Expression<T> = const(field.run { one * value })
override fun multiply(a: Expression<T>, b: Expression<T>): Expression<T> = ProductExpression(field, a, b)