Skip to main content

Module gray_codes

Module gray_codes 

Source
Expand description

Gray codes (reflected binary codes), in which consecutive values differ in exactly one bit.

See the book entry Entropy, divergence and mutual information.

Functionsยง

gray_code
Returns the reflected binary Gray code of n.
gray_code_sequence
Returns the full bits-bit Gray code sequence of length 2^bits (bits <= 32).
gray_decode
Inverts gray_code: returns the n whose Gray code is g.