kumulant

abs

Absolute value of this expression.

The unary and binary maths nodes follow the same rule as the arithmetic operators above: the node itself stays internal so only its @SerialName is a contract, and this factory is the Kotlin way to build one. Every node in this file must be reachable both ways - from Kotlin and from the wire - and a pipeline that can only be authored as JSON is not usable from Kotlin at all.

allFinite

True when every input to the update is finite, whichever modality the stat is.

Use it through the filterFinite() shorthand on each spec type rather than by hand. Unlike isFinite, this covers a whole feature vector, which no per-coordinate expression can.

and

infix fun BoolExpr.and(rhs: BoolExpr): BoolExpr(source)

Short-circuiting conjunction.

div

Build Div of two expressions.


operator fun ScalarExpr.div(rhs: Double): ScalarExpr(source)

Divide this expression by a literal rhs.


operator fun Double.div(rhs: ScalarExpr): ScalarExpr(source)

Divide a literal receiver by an expression.

eq

Exact equality (no tolerance).


infix fun ScalarExpr.eq(rhs: Double): BoolExpr(source)

Exact equality against a literal (no tolerance).


infix fun Double.eq(rhs: ScalarExpr): BoolExpr(source)

Exact equality with a literal left operand (no tolerance).

eval

fun ScalarExpr.eval(x: Double = 0.0, y: Double = 0.0, v: Vector, primary: Result? = null): Double(source)

Evaluate this scalar expression against a borrowed KoBLAS vector without materialising it.

This overload is additive: ScalarExpr.eval with a DoubleArray remains the compatibility surface for callers whose input is already dense.

VFoldOp.Sum and VFoldOp.Mean reduce through koblas, which pairs terms across SIMD lanes for a dense operand and accumulates in order for every other storage. Those associate differently, so the same coordinates reduced from a dense vector and from a sparse one can disagree in the last bits, and a snapshot carrying such a value is only equal to another that was fed the same storage. Every other fold is order-independent and agrees exactly whatever the storage.


fun BoolExpr.eval(x: Double = 0.0, y: Double = 0.0, v: Vector, primary: Result? = null): Boolean(source)

Evaluate this boolean expression against a borrowed KoBLAS vector without materialising it.


fun VectorExpr.eval(x: Double = 0.0, y: Double = 0.0, v: Vector, primary: Result? = null): DoubleArray(source)

Evaluate this vector expression against a borrowed KoBLAS vector, allocating only its owned output.

exp

e raised to this expression. Overflows to +Infinity well before Double runs out of range.

ge

Greater-or-equal comparison.


infix fun ScalarExpr.ge(rhs: Double): BoolExpr(source)

Greater-or-equal against a literal.


infix fun Double.ge(rhs: ScalarExpr): BoolExpr(source)

Greater-or-equal with a literal left operand.

gt

Strictly-greater-than comparison.


infix fun ScalarExpr.gt(rhs: Double): BoolExpr(source)

Strictly-greater-than against a literal.


infix fun Double.gt(rhs: ScalarExpr): BoolExpr(source)

Strictly-greater-than with a literal left operand.

ifThenElse

fun ifThenElse(cond: BoolExpr, then: ScalarExpr, otherwise: ScalarExpr): ScalarExpr(source)

then when cond holds, else otherwise; only the selected branch is evaluated. Builds an IfExpr.


fun ifThenElse(cond: BoolExpr, then: Double, otherwise: ScalarExpr): ScalarExpr(source)

then when cond holds, else otherwise, with a literal then branch.


fun ifThenElse(cond: BoolExpr, then: ScalarExpr, otherwise: Double): ScalarExpr(source)

then when cond holds, else otherwise, with a literal otherwise branch.


fun ifThenElse(cond: BoolExpr, then: Double, otherwise: Double): ScalarExpr(source)

then when cond holds, else otherwise, with literal branches.

inRange

True when this expression falls within [min, max], both ends inclusive.

Distinct from x ge min and (x le max), which builds three nodes and evaluates this expression twice; a filter runs on every update, so the single-node form is the one to reach for.

isFinite

True when this expression evaluates to a finite number: not NaN, and not an infinity.

Stronger than !isNaN(). Prefer it whenever the intent is "a real number", since an infinity passes every ordering comparison the AST can express.

Mean.filter(X.isFinite())

isNaN

True when this expression evaluates to NaN.

A NaN observation propagates through every stat by default; see Stat. Pair this with not to drop them instead, which is the supported way to ask for that:

Mean.filter(!X.isNaN())

le

Less-or-equal comparison.


infix fun ScalarExpr.le(rhs: Double): BoolExpr(source)

Less-or-equal against a literal.


infix fun Double.le(rhs: ScalarExpr): BoolExpr(source)

Less-or-equal with a literal left operand.

ln

Natural logarithm of this expression. ln(0) is -Infinity and a negative input gives NaN.

lt

Strictly-less-than comparison.


infix fun ScalarExpr.lt(rhs: Double): BoolExpr(source)

Strictly-less-than against a literal.


infix fun Double.lt(rhs: ScalarExpr): BoolExpr(source)

Strictly-less-than with a literal left operand.

max

The larger of this expression and other.


The larger of this expression and a constant other.

min

The smaller of this expression and other.


The smaller of this expression and a constant other.

minus

Build Sub of two expressions.


operator fun ScalarExpr.minus(rhs: Double): ScalarExpr(source)

Subtract a literal rhs from this expression.


operator fun Double.minus(rhs: ScalarExpr): ScalarExpr(source)

Subtract an expression from a literal receiver.

ne

Exact inequality, the negation of eq under IEEE 754: true when either side is NaN, and false for 0.0 against -0.0. It builds !(this eq rhs), which encodes with the portable not and eq.


infix fun ScalarExpr.ne(rhs: Double): BoolExpr(source)

Exact inequality against a literal; see ne.


infix fun Double.ne(rhs: ScalarExpr): BoolExpr(source)

Exact inequality with a literal left operand; see ne.

not

operator fun BoolExpr.not(): BoolExpr(source)

Logical negation.

or

infix fun BoolExpr.or(rhs: BoolExpr): BoolExpr(source)

Short-circuiting disjunction.

plus

Build Add of two expressions.


operator fun ScalarExpr.plus(rhs: Double): ScalarExpr(source)

Add a literal rhs to this expression.


operator fun Double.plus(rhs: ScalarExpr): ScalarExpr(source)

Add an expression to a literal receiver.

pow

This expression raised to exponent.


This expression raised to a constant exponent.


This expression raised to an integer exponent, which binary64 represents exactly.

sqrt

Square root of this expression. A negative input gives NaN.

times

Build Mul of two expressions.


operator fun ScalarExpr.times(rhs: Double): ScalarExpr(source)

Multiply this expression by a literal rhs.


operator fun Double.times(rhs: ScalarExpr): ScalarExpr(source)

Multiply a literal receiver by an expression.

unaryMinus

Unary minus: wraps in Neg.

vDot

fun vDot(weights: List<Double>): ScalarExpr(source)

Weighted sum of the feature vector. weights must match the vector length at evaluation time.


fun vDot(vararg weights: Double): ScalarExpr(source)

Weighted sum of the feature vector, varargs form.

vectorOf

Build an output vector by evaluating each expression in order; output length is exprs.size.

The only VectorExpr constructor, and so the only way to reach transformVector / transformX from Kotlin. Reference input coordinates with V: vectorOf(V(2), V(0), V(1)) permutes, vectorOf((V(0) + V(1)) / 2.0) pools, and a shorter list than the input reduces dimensionality.


fun vectorOf(vararg exprs: ScalarExpr): VectorExpr(source)

Build an output vector from expressions in order, varargs form.

vFold

Reduce the whole feature vector to one scalar with op.

The vector-consuming half of the AST, and the only Kotlin-side consumer of VFoldOp.