M-of-n Code
   HOME

TheInfoList



OR:

In
coding theory Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and computer data storage, data sto ...
, a constant-weight code, also called an ''m''-of-''n'' code or ''m''-out-of-''n'' code, is an
error detection and correction In information theory and coding theory with applications in computer science and telecommunications, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
code where all codewords share the same
Hamming weight The Hamming weight of a string (computer science), string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the mo ...
. The
one-hot In digital circuits and machine learning, a one-hot is a group of bits among which the legal combinations of values are only those with a single high (1) bit and all the others low (0). A similar implementation in which all bits are '1' except ...
code and the balanced code are two widely used kinds of constant-weight code. The theory is closely connected to that of
designs A design is the concept or proposal for an object, process, or system. The word ''design'' refers to something that is or has been intentionally created by a thinking agent, and is sometimes used to refer to the inherent nature of something ...
(such as ''t''-designs and
Steiner system 250px, thumbnail, The Fano plane is a Steiner triple system S(2,3,7). The blocks are the 7 lines, each containing 3 points. Every pair of points belongs to a unique line. In combinatorial mathematics, a Steiner system (named after Jakob Steiner ...
s). Most of the work on this field of
discrete mathematics Discrete mathematics is the study of mathematical structures that can be considered "discrete" (in a way analogous to discrete variables, having a bijection with the set of natural numbers) rather than "continuous" (analogously to continuous f ...
is concerned with ''binary'' constant-weight codes. Binary constant-weight codes have several applications, including
frequency hopping Frequency-hopping spread spectrum (FHSS) is a method of transmitting radio signals by rapidly changing the carrier frequency among many frequencies occupying a large spectral band. The changes are controlled by a code known to both transmitter ...
in
GSM The Global System for Mobile Communications (GSM) is a family of standards to describe the protocols for second-generation (2G) digital cellular networks, as used by mobile devices such as mobile phones and Mobile broadband modem, mobile broadba ...
networks.D. H. Smith, L. A. Hughes and S. Perkins (2006).
A New Table of Constant Weight Codes of Length Greater than 28
. ''The Electronic Journal of Combinatorics'' 13.
Most
barcode A barcode or bar code is a method of representing data in a visual, Machine-readable data, machine-readable form. Initially, barcodes represented data by varying the widths, spacings and sizes of parallel lines. These barcodes, now commonly ref ...
s use a binary constant-weight code to simplify automatically setting the brightness threshold that distinguishes black and white stripes. Most
line code In telecommunications, a line code is a pattern of voltage, current, or photons used to represent digital data transmission (telecommunications), transmitted down a communication channel or written to a storage medium. This repertoire of signal ...
s use either a constant-weight code, or a nearly-constant-weight paired disparity code. In addition to use as error correction codes, the large space between code words can also be used in the design of
asynchronous circuit Asynchronous circuit (clockless or self-timed circuit) is a sequential logic, sequential digital logic electrical network, circuit that does not use a global clock circuit or clock signal, signal generator to synchronize its components. Instea ...
s such as
delay insensitive circuit A delay-insensitive circuit is a type of asynchronous circuit which performs a digital logic operation often within a computing processor chip. Instead of using clock signals or other global control signals, the sequencing of computation in delay ...
s. Constant-weight codes, like Berger codes, can detect all unidirectional errors.


''A''(''n'', ''d'', ''w'')

The central problem regarding constant-weight codes is the following: what is the maximum number of codewords in a binary constant-weight code with length n,
Hamming distance In information theory, the Hamming distance between two String (computer science), strings or vectors of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number ...
d, and weight w? This number is called A(n,d,w). Apart from some trivial observations, it is generally impossible to compute these numbers in a straightforward way. Upper bounds are given by several important theorems such as the
first First most commonly refers to: * First, the ordinal form of the number 1 First or 1st may also refer to: Acronyms * Faint Images of the Radio Sky at Twenty-Centimeters, an astronomical survey carried out by the Very Large Array * Far Infrared a ...
and second Johnson bounds, and better upper bounds can sometimes be found in other ways. Lower bounds are most often found by exhibiting specific codes, either with use of a variety of methods from discrete mathematics, or through heavy computer searching. A large table of such record-breaking codes was published in 1990,A. E. Brouwer, James B. Shearer, N. J. A. Sloane and Warren D. Smith (1990). "A New Table of Constant Weight Codes". ''IEEE Transactions of Information Theory'' 36. and an extension to longer codes (but only for those values of d and w which are relevant for the GSM application) was published in 2006.


1-of-''N'' codes

A special case of constant weight codes are the one-of-''N'' codes, that encode \log_2 N bits in a code-word of N bits. The one-of-two code uses the code words 01 and 10 to encode the bits '0' and '1'. A one-of-four code can use the words 0001, 0010, 0100, 1000 in order to encode two bits 00, 01, 10, and 11. An example is dual rail encoding, and chain link used in delay insensitive circuits. For these codes, n=N,~ d=2,~ w=1 and A(n, d, w) = n. Some of the more notable uses of one-hot codes include
biphase mark code Biphase or Bi-phase may refer to: * Biphase modulation, or binary phase-shift keying * Differential Manchester encoding, also known as Aiken biphase or biphase mark code * Harvard biphase, used to encode data onto magnetic tape * Mu-Tron Bi-Pha ...
uses a 1-of-2 code;
pulse-position modulation Pulse-position modulation (PPM) is a form of signal modulation in which ''M'' message bits are encoded by transmitting a single pulse in one of 2^M possible required time shifts. This is repeated every ''T'' seconds, such that the transmitted b ...
uses a 1-of-''n'' code;
address decoder In digital electronics, an address decoder is a binary decoder that has two or more inputs for address bits and one or more outputs for device selection signals. When the address for a particular device appears on the address inputs, the decoder a ...
, etc.


Balanced code

In
coding theory Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and computer data storage, data sto ...
, a balanced code is a
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two values (0 and 1) for each digit * Binary function, a function that takes two arguments * Binary operation, a mathematical op ...
forward error correction In computing, telecommunication, information theory, and coding theory, forward error correction (FEC) or channel coding is a technique used for controlling errors in data transmission over unreliable or noisy communication channels. The centra ...
code for which each codeword contains an equal number of zero and one bits. Balanced codes have been introduced by
Donald Knuth Donald Ervin Knuth ( ; born January 10, 1938) is an American computer scientist and mathematician. He is a professor emeritus at Stanford University. He is the 1974 recipient of the ACM Turing Award, informally considered the Nobel Prize of comp ...
; they are a subset of so-called unordered codes, which are codes having the property that the positions of ones in a codeword are never a subset of the positions of the ones in another codeword. Like all unordered codes, balanced codes are suitable for the detection of all
unidirectional error In telecommunication, a Berger code is a unidirectional error detecting code, named after its inventor, J. M. Berger. Berger codes can detect all unidirectional errors. Unidirectional errors are errors that only flip ones into zeroes or only zeroes ...
s in an encoded message. Balanced codes allow for particularly efficient decoding, which can be carried out in parallel. Some of the more notable uses of balanced-weight codes include
biphase mark code Biphase or Bi-phase may refer to: * Biphase modulation, or binary phase-shift keying * Differential Manchester encoding, also known as Aiken biphase or biphase mark code * Harvard biphase, used to encode data onto magnetic tape * Mu-Tron Bi-Pha ...
uses a 1 of 2 code;
6b/8b encoding In telecommunications, 6b/8b is a line code that expands 6-bit codes to 8-bit symbols for the purposes of maintaining DC-balance in a communications system. The 6b/8b encoding is a balanced code -- each 8-bit output symbol contains 4 zero bits ...
uses a 4 of 8 code; the
Hadamard code The Hadamard code is an error-correcting code named after the French mathematician Jacques Hadamard that is used for error detection and correction when transmitting messages over very noisy or unreliable channels. In 1971, the code was used ...
is a 2^ of 2^k code (except for the zero codeword), the three-of-six code; etc. The 3-wire lane encoding used in MIPI C-PHY can be considered a generalization of constant-weight code to ternary -- each wire transmits a
ternary signal In telecommunications, a ternary signal is a signal that can assume, at any given instant, one of three states or significant conditions, such as power level, phase position, pulse duration, or frequency. Examples of ternary signals are (a) a p ...
, and at any one instant one of the 3 wires is transmitting a low, one is transmitting a middle, and one is transmitting a high signal.


''m''-of-''n'' codes

An ''m''-of-''n'' code is a separable
error detection In information theory and coding theory with applications in computer science and telecommunications, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
code with a code word length of ''n'' bits, where each code word contains exactly ''m'' instances of a "one". A single bit error will cause the code word to have either or "ones". An example ''m''-of-''n'' code is the 2-of-5 code used by the
United States Postal Service The United States Postal Service (USPS), also known as the Post Office, U.S. Mail, or simply the Postal Service, is an independent agencies of the United States government, independent agency of the executive branch of the federal governmen ...
. The simplest implementation is to append a string of ones to the original data until it contains ''m'' ones, then append zeros to create a code of length ''n''. Example: Some of the more notable uses of constant-weight codes, other than the one-hot and balanced-weight codes already mentioned above, include
Code 39 Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is a variable length, discrete barcode symbology defined in ISO/IEC 16388:2023. The Code 39 specification defines 43 characters, consisting of uppercase letters ...
uses a 3-of-9 code;
bi-quinary coded decimal Bi-quinary coded decimal is a numeral encoding scheme used in many abacuses and in some early computers, notably the Colossus. The term ''bi-quinary'' indicates that the code comprises both a two-state (''bi'') and a five-state (''quin''a ...
code uses a 2-of-7 code, the 2-of-5 code, etc.


References

{{reflist


External links


Table of lower bounds on A(n,d,w)
maintained by Andries Brouwer
Table of upper bounds on A(n,d,w)
maintained by Erik Agrell Information theory Error detection and correction