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

Online Help

All Products    Maple    MapleSim


Iterator[MixedRadix]

  

ReflectedGrayToOrdinary

  

convert reflected mixed-radix Gray code to ordinary tuple

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

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

withIterator:-MixedRadix:

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

radices4,3,2:

MIterator:-MixedRadixTuplesradices:

GIterator:-MixedRadixGrayCoderadices:

forginGdoaReflectedGrayToOrdinaryg,radices;printf%2d : %d : %d : %2d\n,RankG,g,a,RankM,aenddo:

 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.

See Also

Iterator[MixedRadix]

Iterator[MixedRadixGrayCode]