ReflectedGrayToOrdinary - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

 ReflectedGrayToOrdinary
 convert reflected mixed-radix Gray code to ordinary tuple

 Calling Sequence ReflectedGrayToOrdinary(a,m)

Parameters

 a - {list,rtable}; tuple m - {list,rtable}; radices

Description

 • ReflectedGrayToOrdinary converts a mixed-radix reflected Gray code tuple to the ordinary mixed-radix tuple of the same rank.
 • The a parameter is the reflected Gray code 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.

Examples

 > $\mathrm{with}\left(\mathrm{Iterator}:-\mathrm{MixedRadix}\right):$

Compare, by rank, the mixed-radix Gray codes with the ordinary mixed-radix tuples.

 > $\mathrm{radices}≔\left[4,3,2\right]:$
 > $M≔\mathrm{Iterator}:-\mathrm{MixedRadixTuples}\left(\mathrm{radices}\right):$
 > $G≔\mathrm{Iterator}:-\mathrm{MixedRadixGrayCode}\left(\mathrm{radices}\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}g\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}G\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}a≔\mathrm{ReflectedGrayToOrdinary}\left(g,\mathrm{radices}\right);\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{printf}\left("%2d : %d : %d : %2d",\mathrm{Rank}\left(G\right),g,a,\mathrm{Rank}\left(M,a\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}:$
 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 : 3 1 0 : 0 1 0 :  5  6 : 2 1 0 : 1 1 0 :  6  7 : 1 1 0 : 2 1 0 :  7  8 : 0 1 0 : 3 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 : 3 2 1 : 0 0 1 : 13 14 : 2 2 1 : 1 0 1 : 14 15 : 1 2 1 : 2 0 1 : 15 16 : 0 2 1 : 3 0 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 : 3 0 1 : 0 2 1 : 21 22 : 2 0 1 : 1 2 1 : 22 23 : 1 0 1 : 2 2 1 : 23 24 : 0 0 1 : 3 2 1 : 24

References

 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. 51.

Compatibility

 • The Iterator[MixedRadix][ReflectedGrayToOrdinary] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.