NAME
Data::BitStream::Code::Fibonacci - A Role implementing Fibonacci codes
VERSION
version 0.02
DESCRIPTION
A role written for Data::BitStream that provides get and set methods for the Fibonacci codes. The role applies to a stream object.
METHODS
Provided Object Methods
- put_fib($value)
- put_fib(@values)
-
Insert one or more values as Fibonacci C1 codes. Returns 1.
- get_fib()
- get_fib($count)
-
Decode one or more Fibonacci C1 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.
- put_fib_c2(@values)
-
Insert one or more values as Fibonacci C2 codes. Returns 1.
Note that the C2 codes are not prefix-free codes, so will not work well with other codes. That is, these codes rely on the bit _after_ the code to be a 1 (or the end of the stream). Other codes may not meet this requirement.
- get_fib_c2()
- get_fib_c2($count)
-
Decode one or more Fibonacci C2 codes from the stream.
Required Methods
- read
- write
- get_unary
- put_string
-
These methods are required for the role.
SEE ALSO
- Alberto Apostolico and Aviezri S. Fraenkel, "Robust Transmission of Unbounded Strings Using Fibonacci Representations", Computer Science Technical Reports, Paper 464, Purdue University, 14 October 1985. http://docs.lib.purdue.edu/cstech/464/
- A.S. Fraenkel and S.T. Klein, "Robust Universal Complete Codes for Transmission and Compression", Discrete Applied Mathematics, Vol 64, pp 31-55, 1996. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.3064
-
These papers introduce and describe the order
m>=2
Fibonacci codes C1, C2, and C3. Them=2
C1 codes are what most people call Fibonacci codes. - http://en.wikipedia.org/wiki/Fibonacci_coding
-
A description of the
m=2
C1 code. - Shmuel T. Klein and Miri Kopel Ben-Nissan, "On the Usefulness of Fibonacci Compression Codes", The Computer Journal, Vol 53, pp 701-716, 2010. http://u.cs.biu.ac.il/~tomi/Postscripts/fib-rev.pdf
-
More information on Fibonacci codes, including
m>2
codes.
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.