SimpleAutoDiffField

open class SimpleAutoDiffField<T : Any, F : Field<T>>(context: F, bindings: Map<Symbol, T>) : Field<AutoDiffValue<T>> , ExpressionAlgebra<T, AutoDiffValue<T>> , NumbersAddOps<AutoDiffValue<T>>

Represents field in context of which functions can be derived.

Constructors

Link copied to clipboard
fun <T : Any, F : Field<T>> SimpleAutoDiffField(context: F, bindings: Map<Symbol, T>)

Functions

Link copied to clipboard
open override fun add(left: AutoDiffValue<T>, right: AutoDiffValue<T>): AutoDiffValue<T>

Addition of two elements.

Link copied to clipboard
open fun binaryOperation(operation: String, left: AutoDiffValue<T>, right: AutoDiffValue<T>): AutoDiffValue<T>

Dynamically invokes a binary operation with the certain name.

Link copied to clipboard
open override fun binaryOperationFunction(operation: String): (left: AutoDiffValue<T>, right: AutoDiffValue<T>) -> AutoDiffValue<T>

Dynamically dispatches a binary operation with the certain name.

Link copied to clipboard
open fun bindSymbol(value: String): AutoDiffValue<T>

The same as bindSymbolOrNull but throws an error if symbol could not be bound

Link copied to clipboard
open override fun bindSymbolOrNull(value: String): AutoDiffValue<T>?

Wraps a raw string to T object. This method is designed for three purposes:

Link copied to clipboard
open override fun const(value: T): AutoDiffValue<T>

A constant expression that does not depend on arguments.

Link copied to clipboard
fun <R> derive(value: R, block: F.(R) -> Unit): R

Performs update of derivative after the rest of the formula in the back-pass.

Link copied to clipboard
open operator fun AutoDiffValue<T>.div(arg: AutoDiffValue<T>): AutoDiffValue<T>

Division of two elements.

open operator fun AutoDiffValue<T>.div(k: Number): AutoDiffValue<T>

Division of this element by scalar.

Link copied to clipboard
open override fun divide(left: AutoDiffValue<T>, right: AutoDiffValue<T>): AutoDiffValue<T>

Division of two elements.

Link copied to clipboard
open fun export(arg: AutoDiffValue<T>): AutoDiffValue<T>

Export an algebra element, so it could be accessed even after algebra scope is closed. This method must be used on algebras where data is stored externally or any local algebra state is used. By default (if not overridden), exports the object itself.

Link copied to clipboard
open fun leftSideNumberOperation(operation: String, left: Number, right: AutoDiffValue<T>): AutoDiffValue<T>

Dynamically invokes a binary operation with the certain name with numeric first argument.

Link copied to clipboard
open fun leftSideNumberOperationFunction(operation: String): (left: Number, right: AutoDiffValue<T>) -> AutoDiffValue<T>

Dynamically dispatches a binary operation with the certain name with numeric first argument.

Link copied to clipboard
open operator fun AutoDiffValue<T>.minus(arg: AutoDiffValue<T>): AutoDiffValue<T>

Subtraction of two elements.

open operator fun Number.minus(other: AutoDiffValue<T>): AutoDiffValue<T>

Subtraction of number from element.

open operator fun AutoDiffValue<T>.minus(other: Number): AutoDiffValue<T>

Subtraction of element from number.

Link copied to clipboard
open override fun multiply(left: AutoDiffValue<T>, right: AutoDiffValue<T>): AutoDiffValue<T>

Multiplies two elements.

Link copied to clipboard
open override fun number(value: Number): AutoDiffValue<T>

Wraps a number to T object.

Link copied to clipboard
open operator fun AutoDiffValue<T>.plus(arg: AutoDiffValue<T>): AutoDiffValue<T>

Addition of two elements.

open operator fun Number.plus(other: AutoDiffValue<T>): AutoDiffValue<T>

Addition of scalar and element.

open operator fun AutoDiffValue<T>.plus(other: Number): AutoDiffValue<T>

Addition of element and scalar.

Link copied to clipboard
open fun power(arg: AutoDiffValue<T>, pow: Int): AutoDiffValue<T>

open fun power(arg: AutoDiffValue<T>, pow: UInt): AutoDiffValue<T>

Raises arg to the integer power pow.

Link copied to clipboard
open fun rightSideNumberOperation(operation: String, left: AutoDiffValue<T>, right: Number): AutoDiffValue<T>

Dynamically invokes a binary operation with the certain name with numeric second argument.

Link copied to clipboard
open fun rightSideNumberOperationFunction(operation: String): (left: AutoDiffValue<T>, right: Number) -> AutoDiffValue<T>

Dynamically dispatches a binary operation with the certain name with numeric first argument.

Link copied to clipboard
open override fun scale(a: AutoDiffValue<T>, value: Double): AutoDiffValue<T>

Scaling an element by a scalar.

Link copied to clipboard
open operator fun AutoDiffValue<T>.times(arg: AutoDiffValue<T>): AutoDiffValue<T>

Multiplies this element by scalar.

open operator fun Number.times(arg: AutoDiffValue<T>): AutoDiffValue<T>

Multiplication of this number by element.

open operator fun AutoDiffValue<T>.times(k: Number): AutoDiffValue<T>

Multiplication of this element by a scalar.

Link copied to clipboard
open operator override fun AutoDiffValue<T>.unaryMinus(): AutoDiffValue<T>

The negation of this element.

Link copied to clipboard
open fun unaryOperation(operation: String, arg: AutoDiffValue<T>): AutoDiffValue<T>

Dynamically invokes a unary operation with the certain name.

Link copied to clipboard
open override fun unaryOperationFunction(operation: String): (arg: AutoDiffValue<T>) -> AutoDiffValue<T>

Dynamically dispatches a unary operation with the certain name.

Link copied to clipboard
open operator fun AutoDiffValue<T>.unaryPlus(): AutoDiffValue<T>

Returns this value.

Properties

Link copied to clipboard
val context: F
Link copied to clipboard
var AutoDiffValue<T>.d: T

A variable accessing inner state of derivatives. Use this value in inner builders to avoid creating additional derivative bindings.

Link copied to clipboard
open override val one: AutoDiffValue<T>

The neutral element of multiplication

Link copied to clipboard
open override val zero: AutoDiffValue<T>

The neutral element of addition.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.acos(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.acosh(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.asin(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.asinh(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.atan(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.atanh(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
inline fun <T : Any, F : Field<T>> SimpleAutoDiffField<T, F>.const(block: F.() -> T): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.cos(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.cosh(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.exp(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.ln(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.pow(x: AutoDiffValue<T>, y: Double): AutoDiffValue<T>
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.pow(x: AutoDiffValue<T>, y: Int): AutoDiffValue<T>
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.pow(x: AutoDiffValue<T>, y: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.sin(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.sinh(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.sqr(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.sqrt(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.tan(x: AutoDiffValue<T>): AutoDiffValue<T>
Link copied to clipboard
fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.tanh(x: AutoDiffValue<T>): AutoDiffValue<T>

Sources

Link copied to clipboard