Dana Jacobsen > Data-BitStream-0.07 > Data::BitStream::Code::BoldiVigna

Download:
Data-BitStream-0.07.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.01   Source   Latest Release: Data-BitStream-0.08

NAME ^

Data::BitStream::Code::BoldiVigna - A Role implementing Zeta codes

VERSION ^

version 0.01

DESCRIPTION ^

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.

METHODS ^

Provided Object Methods

put_boldivigna($k, $value)
put_boldivigna($k, @values)

Insert one or more values as Zeta_k codes. Returns 1.

get_boldivigna($k)
get_boldivigna($k, $count)

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.

Parameters

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.

Required Methods

maxbits
read
write
get_unary
put_unary
get_gamma
put_gamma

These methods are required for the role.

SEE ALSO ^

Paolo Boldi and Sebastiano Vigna, "Codes for the World Wide Web", Internet Math, Vol 2, No 4, pp 407-429, 2005.
http://projecteuclid.org/DPubS/Repository/1.0/Disseminate?view=body&id=pdf_1&handle=euclid.im/1150477666

AUTHORS ^

Dana Jacobsen <dana@acm.org>

COPYRIGHT ^

Copyright 2011 by Dana Jacobsen <dana@acm.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: