kumulant

VectorExpr

@Serializable(with = VectorExprSerializer::class)
sealed interface VectorExpr(source)

Wire-serialisable AST for vector-valued expressions over the same input environment as ScalarExpr / BoolExpr. Used by the spec-side transformVector(VectorExpr) operator when the output is a fresh vector rather than a per-element transform.

Output length need not match input length; use VectorExpr for permutations, dimensionality changes, pooling, feature augmentation. For same-length per-element transforms the simpler transformElement(ScalarExpr) is more direct and pays no extra allocation.

See ScalarExpr for the input-environment convention.

Functions

eval

open fun eval(x: Double = 0.0, y: Double = 0.0, v: DoubleArray = EMPTY_VECTOR, primary: Result? = null): DoubleArray(source)

Evaluate this expression to produce a fresh DoubleArray from the per-update inputs. Concrete implementations choose the output length; downstream transformVector(VectorExpr) propagates it as the new vector dimensionality.

Link copied to clipboard

Bind every scalar reference in a vector projection. Nested binding scopes resolve independently.

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

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