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

Online Help

All Products    Maple    MapleSim


Iterator

  

MultiSeq

  

generate multiple sequences

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

MultiSeq(rngs, opts)

Parameters

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

Options

• 

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.

Description

• 

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.

Examples

withIterator&colon;

Use a range of lists to specify the ranges for the counters.

MMultiSeq1&comma;3..4&comma;1&colon;

PrintM&comma;showrank&colon;

 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.

NumberM

12

(1)

Return the element with rank equal to 4.

UnrankM&comma;4

43

(2)

Copy the iterator, but start with rank equal to 4.

NObjectM&comma;rank=4&colon;

PrintN&comma;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.

MMultiSeq1..4&comma;3..1&colon;

PrintM&comma;showrank&colon;

 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

Compatibility

• 

The Iterator[MultiSeq] command was introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

Iterator

Iterator[MixedRadixTuples]