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:
FindChangePoints
to find, using exponential search, the points where a non decreasing monotonic function changes value.get_implied_distribution
to calculate the implied distribution of a code.
Re-exports§
pub use stats::CodesStats;
pub use stats::CodesStatsWrapper;
Modules§
Structs§
- Count
BitReader - 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. - Count
BitWriter - 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. - DbgBit
Reader - A wrapper over a
BitRead
that report on standard error all operations performed, including all code reads. - DbgBit
Writer - A wrapper over a
BitWrite
that report on standard error all operations performed, including all code writes. - Find
Change Points - Iters the points where the given function change value. This only works for monotonic non decreasing functions.
- Infinite
Iterator - 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.