@staticmethod
def get_lazy_from_normal(bit_len, normal):
    '\n        Throughout Qubiter, we will often refer to "Gray Code" as "lazy\n        ordering". In lazy ordering with bit_len many bits, one gives a\n        sequence of bit vectors of length bit_len, so that two adjacent\n        items of the sequence differ by just one bit. For example 000=0,\n        100=4, 110=6, 010=2, 011=3, 111=7, 101=5, 001=1. Each element of\n        this sequence represented as an int will be called lazy, and each\n        int in the sequence 0, 1, 2, 3, 4, 5, 6, 7 will be called normal.\n        Normal ordering is usually called dictionary ordering. Normal and\n        lazy sequences both start at 0.\n\n        Suppose bit_len = 3. The lazy sequence 000, 100, 110, 010, 011, 111,\n        101, 001 is easily obtained from the "standard" lazy sequence 000,\n        001, 011, 010, 110, 111, 101, 100 by "reflecting" each sequence\n        term. We will use the second sequence because it is more common in\n        the literature.\n\n        References\n        ----------\n        1. Martin Gardener, "Knotted DoughNuts and Other\n        Mathematical Entertainments", chapt. 2, "The Binary Gray Code"\n        2. "Numerical Recipies in C"\n        3. Many books on Discrete Mathematics for CompSci types\n        4. On the web, in Eric\'s Treasure Trove/Math/Gray Codes\n\n        Parameters\n        ----------\n        bit_len : int\n        normal : int\n            Function returns the lazy int that corresponds to this normal int.\n\n        Returns\n        -------\n        int\n\n        '
    lazy_bvec = BitVector(bit_len, normal)
    lazy = lazy_bvec.dec_rep
    if (bit_len > 1):
        for m in range((bit_len - 2), (- 1), (- 1)):
            lazy ^= (((normal >> (m + 1)) & 1) << m)
    return lazy
Throughout Qubiter, we will often refer to "Gray Code" as "lazy
ordering". In lazy ordering with bit_len many bits, one gives a
sequence of bit vectors of length bit_len, so that two adjacent
items of the sequence differ by just one bit. For example 000=0,
100=4, 110=6, 010=2, 011=3, 111=7, 101=5, 001=1. Each element of
this sequence represented as an int will be called lazy, and each
int in the sequence 0, 1, 2, 3, 4, 5, 6, 7 will be called normal.
Normal ordering is usually called dictionary ordering. Normal and
lazy sequences both start at 0.

Suppose bit_len = 3. The lazy sequence 000, 100, 110, 010, 011, 111,
101, 001 is easily obtained from the "standard" lazy sequence 000,
001, 011, 010, 110, 111, 101, 100 by "reflecting" each sequence
term. We will use the second sequence because it is more common in
the literature.

References
----------
1. Martin Gardener, "Knotted DoughNuts and Other
Mathematical Entertainments", chapt. 2, "The Binary Gray Code"
2. "Numerical Recipies in C"
3. Many books on Discrete Mathematics for CompSci types
4. On the web, in Eric's Treasure Trove/Math/Gray Codes

Parameters
----------
bit_len : int
normal : int
    Function returns the lazy int that corresponds to this normal int.

Returns
-------
int
@staticmethod
def get_lazy_from_normal(bit_len, normal):
    '\n        Throughout Qubiter, we will often refer to "Gray Code" as "lazy\n        ordering". In lazy ordering with bit_len many bits, one gives a\n        sequence of bit vectors of length bit_len, so that two adjacent\n        items of the sequence differ by just one bit. For example 000=0,\n        100=4, 110=6, 010=2, 011=3, 111=7, 101=5, 001=1. Each element of\n        this sequence represented as an int will be called lazy, and each\n        int in the sequence 0, 1, 2, 3, 4, 5, 6, 7 will be called normal.\n        Normal ordering is usually called dictionary ordering. Normal and\n        lazy sequences both start at 0.\n\n        Suppose bit_len = 3. The lazy sequence 000, 100, 110, 010, 011, 111,\n        101, 001 is easily obtained from the "standard" lazy sequence 000,\n        001, 011, 010, 110, 111, 101, 100 by "reflecting" each sequence\n        term. We will use the second sequence because it is more common in\n        the literature.\n\n        References\n        ----------\n        1. Martin Gardener, "Knotted DoughNuts and Other\n        Mathematical Entertainments", chapt. 2, "The Binary Gray Code"\n        2. "Numerical Recipies in C"\n        3. Many books on Discrete Mathematics for CompSci types\n        4. On the web, in Eric\'s Treasure Trove/Math/Gray Codes\n\n        Parameters\n        ----------\n        bit_len : int\n        normal : int\n            Function returns the lazy int that corresponds to this normal int.\n\n        Returns\n        -------\n        int\n\n        '
    lazy_bvec = BitVector(bit_len, normal)
    lazy = lazy_bvec.dec_rep
    if (bit_len > 1):
        for m in range((bit_len - 2), (- 1), (- 1)):
            lazy ^= (((normal >> (m + 1)) & 1) << m)
    return lazy