[Jump to code hierarchy]

Gray code[13]

Description

The first Gray code [1], now called the binary reflected Gray code, is a trivial \([n,n,1]\) code that orders length-\(n\) binary strings such that nearest-neighbor strings differ by only one digit via what is known as the Gray map.

Gray map: The Gray map converts a quaternary string over \(\mathbb{Z}_4\) into a binary string such that the Hamming distance of the binary representation is one between any two consecutive quaternary digits. For a single digit, the mapping is \(0\to 00\), \(1\to 01\), \(2\to 11\), and \(3\to 10\). This differs from the usual binary expansion of the natural numbers, which maps \(0\to 00\), \(1\to 01\), \(2\to 10\), and \(3\to 11\). A linear code \(C\) over \(\mathbb{Z}_4\) can be mapped, via the Gray map, to a binary code. The binary code is linear if and only if doubling the component-wise product of any two codewords in \(C\) yields another codeword in \(C\) [4; Thm. 12.2.3].

Gray codes have been generalized such that nearest-neighbor strings differ by only one digit when the strings are arranged in higher-dimensional hypercubes [2]. Further generalizations called combinatorial Gray codes [3] refer to methods to organize combinatorial objects such that successive objects differ in some particular way. Particular \(q\)-ary extensions [5] of Gray codes may be useful in digital imaging and signal processing.

Encoding

Efficient encoder for binary reflected Gray code [6].

Realizations

Three-dimensional imaging [7].Broadcasting and communication [8].

Notes

See Refs. [911] reviews of various Gray codes.

Cousins

Primary Hierarchy

Parents
A linear code \(C\) over \(\mathbb{Z}_4\) can be mapped, via the Gray map, to a binary code. The binary code is linear if and only if doubling the component-wise product of any two codewords in \(C\) yields another codeword in \(C\) [4; Thm. 12.2.3].
Gray code

References

[1]
Gray, Frank. "Pulse code communication." United States Patent Number 2632058 (1953).
[2]
E. N. Gilbert, “Gray Codes and Paths on the n-Cube”, Bell System Technical Journal 37, 815 (1958) DOI
[3]
J. T. Joichi, D. E. White, and S. G. Williamson, “Combinatorial Gray Codes”, SIAM Journal on Computing 9, 130 (1980) DOI
[4]
W. C. Huffman and V. Pless, Fundamentals of Error-Correcting Codes (Cambridge University Press, 2003) DOI
[5]
Yicong Zhou, K. Panetta, S. Agaian, and C. L. P. Chen, “(n, k, p)-Gray code for image systems”, IEEE Transactions on Cybernetics 43, 515 (2013) DOI
[6]
J. R. Bitner, G. Ehrlich, and E. M. Reingold, “Efficient generation of the binary reflected gray code and its applications”, Communications of the ACM 19, 517 (1976) DOI
[7]
G. Sansoni, S. Corini, S. Lazzari, R. Rodella, and F. Docchio, “Three-dimensional imaging based on Gray-code light projection: characterization of the measuring algorithm and development of a measuring system for industrial applications”, Applied Optics 36, 4463 (1997) DOI
[8]
S. L. Johnsson and C.-T. Ho, “Optimum broadcasting and personalized communication in hypercubes”, IEEE Transactions on Computers 38, 1249 (1989) DOI
[9]
C. Savage, “A Survey of Combinatorial Gray Codes”, SIAM Review 39, 605 (1997) DOI
[10]
L. S. Barasch, S. Lakshmivarahan, and S. K. Dhall, “Generalized Gray Codes and Their Properties”, Mathematics for Large Scale Computing 203 (2020) DOI
[11]
T. Mütze, “Combinatorial Gray codes-an updated survey”, (2024) arXiv:2202.01280
[12]
J. J. Vartiainen, M. Möttönen, and M. M. Salomaa, “Efficient Decomposition of Quantum Gates”, Physical Review Letters 92, (2004) arXiv:quant-ph/0312218 DOI
[13]
N. P. D. Sawaya, T. Menke, T. H. Kyaw, S. Johri, A. Aspuru-Guzik, and G. G. Guerreschi, “Resource-efficient digital quantum simulation of d-level systems for photonic, vibrational, and spin-s Hamiltonians”, npj Quantum Information 6, (2020) arXiv:1909.12847 DOI
[14]
A. R. Hammons, P. V. Kumar, A. R. Calderbank, N. J. A. Sloane, and P. Sole, “The Z/sub 4/-linearity of Kerdock, Preparata, Goethals, and related codes”, IEEE Transactions on Information Theory 40, 301 (1994) DOI
[15]
A. R. Hammons Jr., P. V. Kumar, A. R. Calderbank, N. J. A. Sloane, and P. Solé, “The Z_4-Linearity of Kerdock, Preparata, Goethals and Related Codes”, (2002) arXiv:math/0207208
[16]
J. H. Conway and N. J. A. Sloane, “Quaternary constructions for the binary single-error-correcting codes of Julin, Best and others”, Designs, Codes and Cryptography 4, 31 (1994) DOI
[17]
Anxiao Jiang, R. Mateescu, M. Schwartz, and J. Bruck, “Rank Modulation for Flash Memories”, IEEE Transactions on Information Theory 55, 2659 (2009) DOI
[18]
S. T. Dougherty, "Codes over rings." Concise Encyclopedia of Coding Theory (Chapman and Hall/CRC, 2021) DOI
[19]
S. Ling and P. Sole. 2008. Nonadditive quantum codes from Z4-codes. https://hal.archives-ouvertes.fr/hal-00338309/fr/.
Page edit log

Your contribution is welcome!

on github.com (edit & pull request)— see instructions

edit on this site

Zoo Code ID: gray

Cite as:
“Gray code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022. https://errorcorrectionzoo.org/c/gray
BibTeX:
@incollection{eczoo_gray, title={Gray code}, booktitle={The Error Correction Zoo}, year={2022}, editor={Albert, Victor V. and Faist, Philippe}, url={https://errorcorrectionzoo.org/c/gray} }
Share via:
Twitter | Mastodon |  | E-mail
Permanent link:
https://errorcorrectionzoo.org/c/gray

Cite as:

“Gray code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022. https://errorcorrectionzoo.org/c/gray

Github: https://github.com/errorcorrectionzoo/eczoo_data/edit/main/codes/classical/bits/nonlinear/gray_map/gray.yml.