Module utils

Source
Expand description

Helpers and statistics.

CountBitReader and CountBitWriter keep track of the number of bits read or written to a BitRead and BitWrite, respectively, optionally printing on standard error the operations performed on the stream.

DbgBitReader and DbgBitWriter print on standard error all operation beformed by a BitRead or BitWrite.

CodesStats keeps track of the space needed to store a stream of integers using different codes.

It also provides sample_implied_distribution, it is an infinite iterator that returns samples from the implied distribution of a code, and the helper functions and structs we use to implement it:

Re-exports§

pub use stats::CodesStats;
pub use stats::CodesStatsWrapper;

Modules§

stats

Structs§

CountBitReader
A wrapper around a BitRead that keeps track of the number of bits read and optionally prints on standard error the operations performed on the stream.
CountBitWriter
A wrapper around a BitWrite that keeps track of the number of bits written and optionally prints on standard error the operations performed on the stream.
DbgBitReader
A wrapper over a BitRead that report on standard error all operations performed, including all code reads.
DbgBitWriter
A wrapper over a BitWrite that report on standard error all operations performed, including all code writes.
FindChangePoints
Iters the points where the given function change value. This only works for monotonic non decreasing functions.
InfiniteIterator
An infinite iterator that always returns ().

Functions§

get_implied_distribution
Given the len function of a code, generates data that allows to sample its implied distribution, i.e. a code-word with length l has probability 2^(-l).
sample_implied_distribution
Returns an infinite iterator of samples from the implied distribution of the given code length function. The function f should be the len function of the code.