PTWM
context_mixing

ptwm_core::entropy::context_mixing::squash

lpaq squash (logistic) and stretch (logit) over 12-bit probabilities. squash(d) maps a stretched logit d to a probability in 0..=4095; stretch(p) is its inverse. Both are integer and deterministic.

ptwm_core::entropy::context_mixing::squash

lpaq squash (logistic) and stretch (logit) over 12-bit probabilities. squash(d) maps a stretched logit d to a probability in 0..=4095; stretch(p) is its inverse. Both are integer and deterministic.

rsmod

ptwm_core::entropy::context_mixing::squash

crates/ptwm-core/src/entropy/context_mixing/squash.rs:1
mod squash

lpaq `squash` (logistic) and `stretch` (logit) over 12-bit probabilities. `squash(d)` maps a stretched logit `d` to a probability in `0..=4095`; `stretch(p)` is its inverse. Both are integer and deterministic.

rsfn

ptwm_core::entropy::context_mixing::squash::squash

crates/ptwm-core/src/entropy/context_mixing/squash.rs:7
pub fn squash(d: i32) -> i32

Inverse-logit: map a logit `d` (clamped to ±2047) to a probability `0..=4095`. `const fn` so [`STRETCH_TABLE`] can be built at compile time.

rsfn

ptwm_core::entropy::context_mixing::squash::stretch

crates/ptwm-core/src/entropy/context_mixing/squash.rs:45
pub fn stretch(p: i32) -> i32

Logit of a 12-bit probability `p` (`0..=4095`), clamped to `±2047`.