Iterator[MixedRadix]
OrdinaryToReflectedGray
convert ordinary mixed-radix tuple to reflected Gray code
Calling Sequence
Parameters
Description
Examples
References
Compatibility
OrdinaryToReflectedGray(b,m)
b
-
{list,rtable}; tuple
m
{list,rtable}; radices
OrdinaryToReflectedGray converts an ordinary mixed-radix tuple to the mixed-radix reflected Gray code tuple of the same rank.
The b parameter is the ordinary mixed-radix tuple. It is a list or one-dimensional rtable of nonnegative integers. The first element is the low-order element.
The m parameter is the radices. It is a list or one-dimensional rtable of positive integers.
with⁡Iterator:-MixedRadix:
Compare, by rank, the ordinary mixed-radix tuples with the mixed-radix Gray codes.
radices≔4,3,2:
M≔Iterator:-MixedRadixTuples⁡radices:
G≔Iterator:-MixedRadixGrayCode⁡radices:
forbinMdog≔OrdinaryToReflectedGray⁡b,radices;printf⁡%2d : %d : %d : %2d\n,Rank⁡M,b,g,Rank⁡G,genddo:
1 : 0 0 0 : 0 0 0 : 1 2 : 1 0 0 : 1 0 0 : 2 3 : 2 0 0 : 2 0 0 : 3 4 : 3 0 0 : 3 0 0 : 4 5 : 0 1 0 : 3 1 0 : 5 6 : 1 1 0 : 2 1 0 : 6 7 : 2 1 0 : 1 1 0 : 7 8 : 3 1 0 : 0 1 0 : 8 9 : 0 2 0 : 0 2 0 : 9 10 : 1 2 0 : 1 2 0 : 10 11 : 2 2 0 : 2 2 0 : 11 12 : 3 2 0 : 3 2 0 : 12 13 : 0 0 1 : 3 2 1 : 13 14 : 1 0 1 : 2 2 1 : 14 15 : 2 0 1 : 1 2 1 : 15 16 : 3 0 1 : 0 2 1 : 16 17 : 0 1 1 : 0 1 1 : 17 18 : 1 1 1 : 1 1 1 : 18 19 : 2 1 1 : 2 1 1 : 19 20 : 3 1 1 : 3 1 1 : 20 21 : 0 2 1 : 3 0 1 : 21 22 : 1 2 1 : 2 0 1 : 22 23 : 2 2 1 : 1 0 1 : 23 24 : 3 2 1 : 0 0 1 : 24
Knuth, Donald Ervin. The Art of Computer Programming, volume 4, fascicle 2; generating all tuples and permutations, sec. 7.2.1.1, generating all n-tuples, p. 19, eq. 50.
The Iterator[MixedRadix][OrdinaryToReflectedGray] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
Iterator[MixedRadixGrayCode]
Iterator[MixedRadixTuples]
Download Help Document