Data::BitStream::Code::BoldiVigna - A Role implementing Zeta codes
A role written for Data::BitStream that provides get and set methods for Zeta codes of Paolo Boldi and Sebastiano Vigna. These codes are useful for integers distributed as a power law with small exponent (smaller than 2). The role applies to a stream object.
Insert one or more values as Zeta_k codes. Returns 1.
Decode one or more Zeta_k codes from the stream. If count is omitted, one value will be read. If count is negative, values will be read until the end of the stream is reached. In scalar context it returns the last code read; in array context it returns an array of all codes read.
The parameter k must be between 1 and maxbits (32 or 64).
k=1 is equivalent to Elias Gamma coding.
For values of
k > 6 the Elias Delta code will be better.
Typical k values are between 2 and 6.
Dana Jacobsen <firstname.lastname@example.org>
Copyright 2011 by Dana Jacobsen <email@example.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.