transforms
ptwm_core::transforms::int_delta
IntDelta op — intra-plane integer-subtraction delta between consecutive elements (ndzip / FPC-family preprocessing).
ptwm_core::transforms::int_delta
IntDelta op — intra-plane integer-subtraction delta between consecutive elements (ndzip / FPC-family preprocessing).
ptwm_core::transforms::int_delta
crates/ptwm-core/src/transforms/int_delta.rs:1mod int_delta`IntDelta` op — intra-plane integer-subtraction delta between consecutive elements (ndzip / FPC-family preprocessing).
Unlike `XorDelta` and `FloatDelta`, which take a *reference tensor* as a
second input and produce a cross-tensor residual, `IntDelta` is a
single-input intra-plane transform: each element becomes the integer
difference from its predecessor in the same plane.
For smoothly-varying data (think attention-weight rows whose neighbouring
values are numerically close), the integer delta is concentrated near zero
and compresses harder under the downstream entropy coder than the raw
byte stream does. This is the same preprocessing used by ndzip and FPC
for scientific floating-point streams; see
[ndzip-gpu (ICS 2021)](https://dps.uibk.ac.at/~fabian/publications/2021-ndzip-gpu-efficient-lossless-compression-of-scientific-floating-point-data-on-gpus.pdf).
## Element-width awareness
The delta is computed at the plane descriptor's `element_width`:
- `Byte` (1 B) — byte-level wrapping subtraction.
- `Word2` (2 B) — pairs interpreted as little-endian u16, wrapping sub.
- `Word4` (4 B) — u32 LE, wrapping sub.
- `Word8` (8 B) — u64 LE, wrapping sub.
- `Nibble` — rejected; semantics are ambiguous for half-byte elements.
Round-trip is exact for every input the encoder accepts. The op is
pure-byte (no `lossy` feature gate) because integer wrapping is
involutive in the same way XOR is.
ptwm_core::transforms::int_delta::IntDelta
crates/ptwm-core/src/transforms/int_delta.rs:44pub struct IntDelta;Intra-plane element-wise integer-subtraction delta.
`forward`: `out[0] = in[0]`, `out[i] = in[i].wrapping_sub(in[i-1])`.
`inverse`: `in[0] = out[0]`, `in[i] = out[i].wrapping_add(in[i-1])`.
The stride is the plane's `element_width`. Wrapping arithmetic at that
width is exactly invertible.