Dev #194
@ -3,6 +3,7 @@ package kscience.kmath.expressions
|
|||||||
import kscience.kmath.operations.Algebra
|
import kscience.kmath.operations.Algebra
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A marker interface for a symbol. A symbol mus have an identity
|
* A marker interface for a symbol. A symbol mus have an identity
|
||||||
@ -84,8 +85,8 @@ public interface ExpressionAlgebra<in T, E> : Algebra<E> {
|
|||||||
public fun <T, E> ExpressionAlgebra<T, E>.bind(symbol: Symbol): E =
|
public fun <T, E> ExpressionAlgebra<T, E>.bind(symbol: Symbol): E =
|
||||||
bindOrNull(symbol) ?: error("Symbol $symbol could not be bound to $this")
|
bindOrNull(symbol) ?: error("Symbol $symbol could not be bound to $this")
|
||||||
|
|
||||||
public val symbol: ReadOnlyProperty<Any?, StringSymbol> = ReadOnlyProperty { _, property ->
|
public val symbol: ReadOnlyProperty<Any?, StringSymbol> = object : ReadOnlyProperty<Any?, StringSymbol> {
|
||||||
StringSymbol(property.name)
|
override fun getValue(thisRef: Any?, property: KProperty<*>): StringSymbol = StringSymbol(property.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T, E> ExpressionAlgebra<T, E>.binding(): ReadOnlyProperty<Any?, E> =
|
public fun <T, E> ExpressionAlgebra<T, E>.binding(): ReadOnlyProperty<Any?, E> =
|
||||||
|
@ -244,7 +244,6 @@ public fun <T : Any, F : Field<T>> simpleAutoDiff(field: F): AutoDiffProcessor<T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extensions for differentiation of various basic mathematical functions
|
// Extensions for differentiation of various basic mathematical functions
|
||||||
|
|
||||||
// x ^ 2
|
// x ^ 2
|
||||||
|
Loading…
Reference in New Issue
Block a user