ddn.columnar.compute

The compute layer of ddn.df: arithmetic; comparison, logic and aggregations follow in the later tasks of phase D (D12; ADR-2026-10-18-05).

Binary operations cast both operands to the arithmetic supertype and dispatch once. Kernels compute every slot and combine the validities (D14); null slots hold arbitrary bits, so the integer division and modulo guards run on every slot, null slots included. Integer `/` yields FLOAT64 (true division); overflow wraps like D.

Functions 85

private fnArrayData rewrapChunk(const ArrayData chunk, DataType dtype) @trusted pure nothrowThe binary arithmetic operations on two Series of equal length: both operands are cast to the supertype first, one dispatch runs the kernel, nulls propagate, and the integer guards null their slots...
private fnbool isTemporalPair(DataType a, DataType b) @safe pure nothrow
private fnDataType temporalArithResult(string op, Kind ka, Kind kb)
fnSeries binaryArith(string op)(Series a, Series b)
fnSeries scalarArith(string op, T)(Series a, T scalar, bool scalarOnLeft = false)The arithmetic operations between a Series and a scalar of a supported type, in either operand order. The supertype rules apply to the scalar's kind as well; `INT8` series `+ 1` (an `int`) yields `...
fnSeries negate(Series a)Unary negation of a numeric Series; non-numeric kinds throw. Nulls propagate.
fnSeries compare(string op)(Series a, Series b)The comparison operations on two Series of equal length. Comparisons require the same kind (temporal with temporal, string with string, boolean with boolean for `eq`/`ne`); numeric pairs compare at...
private fnSeries decimalCompare(string op)(Series a, Series b)
private fnSeries structuralEq(bool equality)(Series a, Series b)
fnSeries compareScalar(string op, T)(Series a, T scalar)The comparison operations between a Series and a scalar, with the same-kind rule and null propagation (`[1, null, 2].eq(1)` is `[true, null, false]`).
private fnNullable!(ResultT!(op, T)) arithApply(string op, T)(T x, T y) @safe pure nothrow
private fnulong windowWord(const Bitmap bm, size_t start, size_t n) @safe pure nothrowThe packed word of `n` bits of `bm` starting at `start`, LSB-first; the sentinel validity (no nulls) reads as all-ones, and the bits past `n` are cleared.
private fnvoid combineValidity(const Bitmap av, size_t aStart, const Bitmap bv, size_t bStart, size_t n, ulong[] words) @safe pure nothrowFills `words` with the conjunction of the validity windows of two chunk positions, one packed bit per slot.
private fnArrayData seriesSeriesTyped(string op, Kind K)(ArrayData[] ca, ArrayData[] cb)
private fnSeries scalarBuild(string op, T)(Series a, T scalar, bool scalarOnLeft)
fnSeries floatUnary(string fn)(Series s)
private fnvoid mathGate(string fn, DataType dtype)
fnSeries mathUnary(string fn)(Series s)The unary mathematical transforms (`sqrt`, `cbrt`, `exp`, `log`, `log2`, `log10`, `log1p`, `expm1`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`) over a numeric Series: FLOAT32 and FLOAT64 keep thei...
private fnArrayData intPowKernel(Kind K)(ArrayData[] ca, ArrayData[] cb)
private fnT ipowWrap(T)(immutable T base, immutable T exp) @safe pure nothrow
private fnbool isIntegerKind(Kind k) @safe pure nothrow
private fnSeries mathBinaryPair(string fn)(Series a, Series b, bool forceFloat)
fnSeries pow(Series base, Series exponent)`base` raised to the `exponent` Series, elementwise: float pairs compute at their supertype (FLOAT32 x FLOAT32 stays FLOAT32, computed in double and rounded once); integer pairs stay integer with w...
fnSeries pow(T)(Series base, T exponent) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar exponent.
fnSeries pow(T)(T base, Series exponent) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar base.
fnSeries atan2(Series y, Series x)The angle whose tangent is `y/x`, elementwise (`atan2(y, x)`): float pairs compute at their supertype (FLOAT32 x FLOAT32 stays FLOAT32, computed in double and rounded once); integer pairs promote t...
fnSeries atan2(T)(Series y, T x) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar `x`.
fnSeries atan2(T)(T y, Series x) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar `y`.
private fnSeries intPowScalarFinish(T)(Series col, T scalar, bool scalarOnLeft)
private fnvoid bitGate(string op, DataType dtype)
private fnvoid checkShiftCount(string op, long count, DataType dtype)
private fnvoid checkShiftCountElem(string op, long count, uint width)
fnSeries bitOp(string op)(Series a, Series b)The integer bitwise operations between two columns (ADR-2026-10-30-01): `&`, `|`, `^`, `<<` and `>>` over integer kinds paired at the arithmetic supertype (`INT8 & INT16` yields `INT16`); nulls pro...
fnSeries bitOpScalar(string op, T, bool scalarOnLeft = false)(Series a, T scalar) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar (either side).
fnSeries bitComplement(Series a)Ditto, the complement `~a`.
private fnSeries unaryFinish(Series s, ArrayData chunk)
fnSeries clipSeries(T)(Series s, T lower, T upper)
private fnulong[] cumInputValidity(ArrayData[] chunks, size_t len) @safe pure nothrow
private fnsize_t totalLenOf(ArrayData[] chunks) @safe pure nothrow
private fnbool anyNullOf(ArrayData[] chunks) @safe pure nothrow
fnSeries cumSeries(string op)(Series s)
private fnArrayData quantileKernel(Kind K)(ArrayData[] chunks, double q)
private fnbool ordLess(T)(T a, T b) @safe pure nothrow
private fnbool selectEndpoints(Kind K)(Series s, size_t lo, size_t hi, out double vlo, out double vhi)
private fndouble sortedReadAt(Kind K)(Series s, size_t[] perm, size_t i)
private fnsize_t chunkStartOf(Series s, size_t ci) @safe pure nothrow
private fnT valueOfPhysical(T)(Series s, size_t ci, size_t li) @safe pure nothrow
private fnArrayData varianceKernel(Kind K)(ArrayData[] chunks, size_t ddof)
private fnArrayData stdKernel(Kind K)(ArrayData[] chunks, size_t ddof)
fnSeries varianceSeries(Series s, size_t ddof)
fnSeries stdSeries(Series s, size_t ddof)
private fnulong[] combineValidityWords(Bitmap validity, size_t len) @safe pure nothrowPacks one chunk's validity bitmap into raw builder words (the builder-append form of the bitmap, tails included).
private fnArrayData negateKernel(Kind K)(ArrayData[] chunks)
fnSeries logicAnd(Series a, Series b)Kleene `and` on BOOLEAN Series: `false and null` is `false`, `true and null` is `null`, null operands otherwise propagate.
fnSeries logicOr(Series a, Series b)Kleene `or` on BOOLEAN Series: `true or null` is `true`, `false or null` is `null`, null operands otherwise propagate.
fnSeries logicXor(Series a, Series b)`xor` on BOOLEAN Series; any null operand yields null.
fnSeries logicNot(Series a)`not` on a BOOLEAN Series; null yields null.
private fnSeries logic(bool isAnd)(Series a, Series b)
private fnvoid kleeneAndWord(ulong ab, ulong av, ulong bb, ulong bv, size_t n, ref ulong rb, ref ulong rv) @safe pure nothrowOne Kleene `and` word: the conjunction of the value bits and the validity word of the three-valued truth table (`false and null` is `false`, `true and null` is null).
private fnvoid kleeneOrWord(ulong ab, ulong av, ulong bb, ulong bv, size_t n, ref ulong rb, ref ulong rv) @safe pure nothrowOne Kleene `or` word: the disjunction of the value bits and the validity word of the three-valued truth table (`true or null` is `true`, `false or null` is null).
private fnvoid xorWord(ulong ab, ulong av, ulong bb, ulong bv, size_t n, ref ulong rb, ref ulong rv) @safe pure nothrowOne `xor` word: null operands propagate, otherwise the value bits differ.
private fnArrayData booleanWalk(alias combine)(Series a, Series b)Walks two BOOLEAN Series in aligned segments - the largest runs that stay within one chunk of each side - applying `combine` per 64-slot word and packing the results into one BOOLEAN chunk. Reading...
fnSeries when(Series mask, Series a, Series b)Eager conditional selection (ADR-2026-10-23-08): element-wise `mask ? a : b` under the approved semantics - a BOOLEAN mask of the branches' length, supertype-promoted branches, and a null mask slot...
fnSeries when(T)(Series mask, Series a, T b) if (!is(T == Series))Ditto, with a scalar `b` branch broadcast across the mask.
fnSeries when(T)(Series mask, T a, Series b) if (!is(T == Series))Ditto, with a scalar `a` branch broadcast across the mask.
fnSeries when(T, U)(Series mask, T a, U b) if (!is(T == Series) && !is(U == Series))Ditto, with both branches scalar.
private fnvoid whenMaskChecks(Series mask, ulong la, ulong lb)
private fnSeries scalarBranchPromotion(T)(T value, DataType common)
private fnSeries broadcastBranch(T)(T value, size_t n)
private fnsize_t min3(size_t a, size_t b, size_t c) @safe pure nothrow
private fnSeries compareScalarTyped(string op, T)(Series a, T scalar)
fnDataType sumDtypeOf(DataType d) @safe pure nothrow
private fnvoid eachValid(Kind K, alias fn)(const ArrayData chunk) @safe pure nothrowRuns `fn(value)` for every valid element of one chunk in index order, word-wise over the validity bitmap (ADR-2026-10-18-11): sentinel chunks (all valid) walk the raw values - the dense, auto-vecto...
fnArrayData aggregateSeries(string agg)(Series s)Aggregates a Series into a one-slot chunk with the kernel `agg` (`"sum"`, `"count"`, `"mean"`, `"min"`, `"max"`, `"first"`, `"last"`), in the result dtype section 6.4 assigns.
private fnNullable!T readSlotAs(Kind K, T)(ArrayData slot)
private fnbool aggLess(T)(T a, T b) @safe pure nothrow
private fnvoid appendOne(Kind K, Build, V)(ref Build b, V view, size_t i)

Templates 21

tmplisNumericKind(Kind K)
tmplisFloatingT(T)
tmplResultT(string op, T)
tmplseriesSeriesKernel(string op)
Functions
ArrayData seriesSeriesKernel(Kind K)(ArrayData[] ca, ArrayData[] cb)
tmplabsKernel(Kind K)
Functions
ArrayData absKernel(ArrayData[] chunks)
tmplfloatUnaryKernel(string fn)
Functions
ArrayData floatUnaryKernel(Kind K)(ArrayData[] chunks)
tmplclipKernel(Kind K, T)
Functions
ArrayData clipKernel(ArrayData[] chunks, T lower, T upper)
tmplfloatBinaryKernel(string fn)
Functions
ArrayData floatBinaryKernel(Kind K)(ArrayData[] ca, ArrayData[] cb)
tmplbitSeriesKernel(string op)
Functions
ArrayData bitSeriesKernel(Kind K)(ArrayData[] ca, ArrayData[] cb)
tmplbitScalarKernel(string op, bool scalarOnLeft)
Functions
ArrayData bitScalarKernel(Kind K)(ArrayData[] chunks, long scalar)
tmplfloatBinaryScalarKernel(string fn, bool scalarOnLeft)
Functions
ArrayData floatBinaryScalarKernel(Kind K)(ArrayData[] chunks, double scalar)
tmplIntScalarT(Kind K)
tmplintPowScalarKernel(bool scalarOnLeft)
Functions
ArrayData intPowScalarKernel(Kind K)(ArrayData[] chunks, long scalar)
tmplcumExtremumKernel(string op)
Functions
ArrayData cumExtremumKernel(Kind K)(ArrayData[] chunks)
tmplwhenScalarIsAKernel(Kind K)
tmplwhenScalarIsBKernel(Kind K)

Ditto, scalar on the mask-false side.

tmplwhenBothScalarKernel(Kind K)
Functions
ArrayData whenBothScalarKernel(ArrayData[] cm, ArrayData scalarA, ArrayData scalarB)
tmplwhenKernel(Kind K)
Functions
ArrayData whenKernel(ArrayData[] cm, ArrayData[] ca, ArrayData[] cb)
tmplwhenScalarKernel(Kind K, bool scalarIsA)
Functions
ArrayData whenScalarKernel(ArrayData[] cm, ArrayData[] cs, ArrayData scalar)
tmplcompareKernel(string op)
Functions
ArrayData compareKernel(Kind K)(ArrayData[] ca, ArrayData[] cb)
tmplaggKernel(string agg)
Functions
ArrayData aggKernel(Kind K)(ArrayData[] chunks)