HOME

TheInfoList



OR:

Elias ω coding or Elias omega coding is a universal code encoding the positive integers developed by
Peter Elias Peter Elias (November 23, 1923 – December 7, 2001) was a pioneer in the field of information theory. Born in New Brunswick, New Jersey, he was a member of the Massachusetts Institute of Technology faculty from 1953 to 1991. In 1955, Elias introd ...
. Like
Elias gamma coding Elias γ code or Elias gamma code is a universal code encoding positive integers developed by Peter Elias. It is used most commonly when coding integers whose upper-bound cannot be determined beforehand. Encoding To code a number ''x'' ï¿½ ...
and
Elias delta coding Elias δ code or Elias delta code is a universal code encoding the positive integers developed by Peter Elias. Encoding To code a number ''X'' â‰¥ 1: # Let ''N'' = ⌊log2 ''X''⌋; be the highest power of 2 in ''X'', so 2''N'' ≤ ' ...
, it works by prefixing the positive integer with a representation of its
order of magnitude An order of magnitude is an approximation of the logarithm of a value relative to some contextually understood reference value, usually 10, interpreted as the base of the logarithm and the representative of values of magnitude one. Logarithmic di ...
in a universal code. Unlike those other two codes, however, Elias omega recursively encodes that prefix; thus, they are sometimes known as recursive Elias codes. Omega coding is used in applications where the largest encoded value is not known ahead of time, or to
compress compress is a Unix shell compression program based on the LZW compression algorithm. Compared to more modern compression utilities such as gzip and bzip2, compress performs faster and with less memory usage, at the cost of a significantly l ...
data in which small values are much more frequent than large values. To encode a
positive integer In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called '' cardinal ...
''N'': #Place a "0" at the end of the code. #If ''N'' = 1, stop; encoding is complete. #Prepend the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that ta ...
representation of ''N'' to the beginning of the code. This will be at least two bits, the first bit of which is a 1. #Let ''N'' equal the number of bits just prepended, minus one. #Return to Step 2 to prepend the encoding of the new ''N''. To decode an Elias omega-encoded positive integer: #Start with a variable ''N'', set to a value of 1. #If the next bit is a "0" then stop. The decoded number is ''N''. #If the next bit is a "1" then read it plus ''N'' more bits, and use that binary number as the new value of ''N''. Go back to Step 2.


Examples

Omega codes can be thought of as a number of "groups". A group is either a single 0 bit, which terminates the code, or two or more bits beginning with 1, which is followed by another group. The first few codes are shown below. Included is the so-called ''implied distribution'', describing the distribution of values for which this coding yields a minimum-size code; see Relationship of universal codes to practical compression for details. The encoding for 1
googol A googol is the large number 10100. In decimal notation, it is written as the digit 1 followed by one hundred zeroes: 10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, ...
, 10100, is 11 1000 101001100 (15 bits of length header) followed by the 333-bit binary representation of 1 googol, which is 10010 01001001 10101101 00100101 10010100 11000011 01111100 11101011 00001011 00100111 10000100 11000100 11001110 00001011 11110011 10001010 11001110 01000000 10001110 00100001 00011010 01111100 10101010 10110010 01000011 00001000 10101000 00101110 10001111 00010000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 and a trailing 0, for a total of 349 bits. A googol to the hundredth power (1010000) is a 33,220-bit binary number. Its omega encoding is 33,243 bits long: 11 1111 1000000111000100 (22 bits), followed by 33,220 bits of the value, and a trailing 0. Under
Elias delta coding Elias δ code or Elias delta code is a universal code encoding the positive integers developed by Peter Elias. Encoding To code a number ''X'' â‰¥ 1: # Let ''N'' = ⌊log2 ''X''⌋; be the highest power of 2 in ''X'', so 2''N'' ≤ ' ...
, the same number is 33,250 bits long: 000000000000000 1000000111000100 (31 bits) followed by 33,219 bits of the value. The omega and delta coding are, respectively, 0.07% and 0.09% longer than the ordinary 33,220-bit binary representation of the number. For the encoding of a positive integer , the number of bits needed, , is computable recursively: \beginB(0) & = 0\,, \\ B(N) & = 1 + \lfloor \log_2(N) \rfloor + B(\lfloor \log_2(N) \rfloor)\,. \end


Example code


Encoding

void eliasOmegaEncode(char* source, char* dest)


Decoding

void eliasOmegaDecode(char* source, char* dest)


Generalizations

Elias omega coding does not encode zero or negative integers. One way to encode all non-negative integers is to add 1 before encoding and then subtract 1 after decoding, or use the very similar Levenshtein coding. One way to encode all integers is to set up a bijection, mapping all integers (0, 1, -1, 2, -2, 3, -3, ...) to strictly positive integers (1, 2, 3, 4, 5, 6, 7, ...) before encoding.


See also

* Elias delta (δ) coding * Elias gamma (γ) coding * Even-Rodeh coding


References


Further reading

* *


External links


Implementation in Python
{{DEFAULTSORT:Elias Omega Coding Numeral systems Lossless compression algorithms