Unary coding,[nb 1] or the unary numeral system and also sometimes called thermometer code, is an entropy encoding that represents a natural number, n, with a code of length n + 1 ( or n ), usually n ones followed by a zero (if natural number is understood as non-negative integer) or with n − 1 ones followed by a zero (if natural number is understood as strictly positive integer). For example 5 is represented as 111110 or 11110. Some representations use n or n − 1 zeros followed by a one. The ones and zeros are interchangeable without loss of generality. Unary coding is both a prefix-free code and a self-synchronizing code.
n (non-negative)
n (strictly positive)
Unary code
Alternative
0
1
0
1
1
2
10
01
2
3
110
001
3
4
1110
0001
4
5
11110
00001
5
6
111110
000001
6
7
1111110
0000001
7
8
11111110
00000001
8
9
111111110
000000001
9
10
1111111110
0000000001
Unary coding is an optimally efficient encoding for the following discrete probability distribution
for .
In symbol-by-symbol coding, it is optimal for any geometric distribution
for which k ≥ φ = 1.61803398879..., the golden ratio, or, more generally, for any discrete distribution for which
for . Although it is the optimal symbol-by-symbol coding for such probability distributions, Golomb coding achieves better compression capability for the geometric distribution because it does not consider input symbols independently, but rather implicitly groups the inputs. For the same reason, arithmetic encoding performs better for general probability distributions, as in the last case above.
Cite error: There are <ref group=nb> tags on this page, but the references will not show without a {{reflist|group=nb}} template (see the help page).
Unarycoding, or the unary numeral system and also sometimes called thermometer code, is an entropy encoding that represents a natural number, n, with...
up unary in Wiktionary, the free dictionary. Unary may refer to: Unary numeral system, the simplest numeral system to represent natural numbers Unary function...
the application in tally marks, unary numbering is used as part of some data compression algorithms such as Golomb coding. It also forms the basis for the...
static code may be useful. These static codes include universal codes (such as Elias gamma coding or Fibonacci coding) and Golomb codes (such as unary coding...
in unarycoding, followed by the remainder in truncated binary encoding. When M = 1 {\displaystyle M=1} , Golomb coding is equivalent to unarycoding. Golomb–Rice...
Exponential-Golomb coding generalizes the gamma code to integers with a "flatter" power-law distribution, just as Golomb coding generalizes the unarycode. It involves...
for example, in GMP. In certain biological systems, the unarycoding system is employed. Unary numerals used in the neural circuits responsible for birdsong...
Shannon–Fano codes, and universal codes such as: Elias delta coding Elias gamma coding Elias omega coding Fibonacci coding Levenshtein codingUnarycoding Golomb...
Fibonacci coding is a comma code in which the comma is 11. 11 and 1011 are valid Fibonacci code words, but 101, 0111, and 11011 are not. Unarycoding, in which...
values in a list of strictly increasing integers and encode them using unarycoding, the result is a bit array with a 1 bit in the nth position if and only...
and Vedic chronology Number theoretic Hilbert transform Science wars Unarycoding Kurien, Prema A. (2007). A place at the multicultural table the development...
encoding Unarycoding: code that represents a number n with n ones followed by a zero Universal codes: encodes positive integers into binary code words Elias...
function takes no arguments. Example: f ( ) = 2 {\displaystyle f()=2} A unary function takes one argument. Example: f ( x ) = 2 x {\displaystyle f(x)=2x}...
(CC1 network) or remains constant (CC4 network). These networks use unarycoding for an effective representation of the data sets. This type of network...
analysis, Cauchy sequence. In discrete mathematics and computer science, Unarycoding. In set theory, a fundamental sequence for an ordinal is a sequence of...
standard ICs such as the CMOS 4511. A binary to unary decoder converts each binary value to its associated unary representation. Unlike the 1-of-n (one-hot)...
the following keywords (‘else’, ‘case’, ‘default’, ‘?’). Occurrence of a unary conditional operator. The following rules give the count of Assignments...
and the programming language bc, unary operations have a higher priority than binary operations, that is, the unary minus has higher precedence than exponentiation...
this nanoscale quantum process provides evidence that an on/off (UNARY +/-) coding system exists at the most fundamental level of brain operation. In...
unary minus, which binds more strongly than multiplication or division. However, in some programming languages (Microsoft Excel in particular), unary...
sizeof is a unary operator in the programming languages C and C++. It generates the storage size of an expression or a data type, measured in the number...