License
BSD-3-Clause
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.
ArrayData 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...Series binaryArith(string op)(Series a, Series b)Series 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 `...Series negate(Series a)Unary negation of a numeric Series; non-numeric kinds throw. Nulls propagate.Series 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...Series 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]`).ulong 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.void 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.Series floatUnary(string fn)(Series s)Series 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...Series 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...Series pow(T)(Series base, T exponent) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar exponent.Series pow(T)(T base, Series exponent) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar base.Series 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...Series atan2(T)(Series y, T x) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar `x`.Series atan2(T)(T y, Series x) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar `y`.Series 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...Series bitOpScalar(string op, T, bool scalarOnLeft = false)(Series a,
T scalar) if (isSupportedScalar!T && !is(T == Series))Ditto, with a broadcast scalar (either side).Series clipSeries(T)(Series s, T lower, T upper)ArrayData cumSumKernel(Kind K)(ArrayData[] chunks)ArrayData cumCountKernel(Kind K)(ArrayData[] chunks)bool selectEndpoints(Kind K)(Series s, size_t lo, size_t hi,
out double vlo, out double vhi)Series varianceSeries(Series s, size_t ddof)Series quantileSeries(Series s, double q)ulong[] 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).Series logicAnd(Series a, Series b)Kleene `and` on BOOLEAN Series: `false and null` is `false`, `true and null` is `null`, null operands otherwise propagate.Series logicOr(Series a, Series b)Kleene `or` on BOOLEAN Series: `true or null` is `true`, `false or null` is `null`, null operands otherwise propagate.void 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).void 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).void 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.ArrayData 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...Series 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...Series when(T)(Series mask, Series a, T b) if (!is(T == Series))Ditto, with a scalar `b` branch broadcast across the mask.Series when(T)(Series mask, T a, Series b) if (!is(T == Series))Ditto, with a scalar `a` branch broadcast across the mask.Series when(T, U)(Series mask, T a, U b) if (!is(T == Series) && !is(U == Series))Ditto, with both branches scalar.void 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...ArrayData 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.Ditto, scalar on the mask-false side.