Iterator
MultiSeq
generate multiple sequences
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
MultiSeq(rngs, opts)
rngs
-
specifies the start and finish values of the counters
opts
(optional) equation(s) of the form option = value; specify options for the MultiSeq command
compile = truefalse
True means compile the iterator. The default is true.
rank = nonnegint
Specify the starting rank of the iterator. The default is one. Passing a value greater than one causes the iterator to skip the lower ranks; this can be useful when parallelizing iterators. The starting rank reverts to one when the iterator is reset, reused, or copied.
The MultiSeq command returns an iterator that advances the elements of an Array as if they were the counters of nested loops.
The rngs parameter specifies the range of each counter. It can be
a range of lists of integers, e.g., [1,3] .. [4,1]
a range of one-dimensional rtables of integers, e.g., <1,3> .. <4,1>,
a list of ranges of integer, e.g., [1..4, 3..1],
a one-dimensional rtable of integers, e.g., <1..4, 3..1>.
At each iteration, the first counter is advanced. If the i-th counter is at its finish value when it is advanced, it is assigned its start value and the i+1 counter is advanced.
The iteration ends when all counters reach their finish values.
If the finish value of a counter is less than its start value, it is decremented rather than incremented when advanced.
Methods
In addition to the common iterator methods, this iterator object has the following methods. The self parameter is the iterator object.
Number(self): return the number of iterations required to step through the iterator, assuming it started at rank one.
Rank(self,L): return the rank of the current iteration. Optionally pass L, a list or one-dimensional rtable, and return its rank.
Unrank(self,rnk): return a one-dimensional Array corresponding to the iterator output with rank rnk.
with⁡Iterator:
Use a range of lists to specify the ranges for the counters.
M≔MultiSeq⁡1,3..4,1:
Print⁡M,showrank:
1: 1 3 2: 2 3 3: 3 3 4: 4 3 5: 1 2 6: 2 2 7: 3 2 8: 4 2 9: 1 1 10: 2 1 11: 3 1 12: 4 1
Compute the number of iterations.
Number⁡M
12
Return the element with rank equal to 4.
Unrank⁡M,4
43
Copy the iterator, but start with rank equal to 4.
N≔Object⁡M,rank=4:
Print⁡N,showrank
4: 4 3 5: 1 2 6: 2 2 7: 3 2 8: 4 2 9: 1 1 10: 2 1 11: 3 1 12: 4 1
Use a list of ranges to specify the ranges.
M≔MultiSeq⁡1..4,3..1:
The Iterator[MultiSeq] command was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
See Also
Iterator[MixedRadixTuples]
Download Help Document