Iteration
This section of the manual describes the Iteration module.
ReachabilityBase.Iteration — ModuleIterationThis module provides convenience functionality for iteration.
ReachabilityBase.Iteration.StrictlyIncreasingIndices — TypeStrictlyIncreasingIndicesIterator over the vectors of m strictly increasing indices from 1 to n.
Fields
n– size of the index domainm– number of indices to choose (resp. length of the vectors)
Notes
The vectors are modified in-place.
The iterator ranges over $\binom{n}{m}$ (n choose m) possible vectors.
This implementation results in a lexicographic order with the last index growing first.
See also NondecreasingIndices for a nondecreasing iterator.
Examples
julia> for v in StrictlyIncreasingIndices(4, 2)
           println(v)
       end
[1, 2]
[1, 3]
[1, 4]
[2, 3]
[2, 4]
[3, 4]ReachabilityBase.Iteration.NondecreasingIndices — TypeNondecreasingIndicesIterator over the vectors of m nondecreasing indices from 1 to n.
Fields
n– size of the index domainm– number of indices to choose (resp. length of the vectors)
Notes
The vectors are modified in-place.
The iterator ranges over $\binom{n + m - 1}{m}$ (n + m - 1 choose m) possible vectors.
This implementation results in a lexicographic order with the last index growing first.
See also StrictlyIncreasingIndices for a strictly increasing iterator.
Examples
julia> for v in NondecreasingIndices(4, 2)
           println(v)
       end
[1, 1]
[1, 2]
[1, 3]
[1, 4]
[2, 2]
[2, 3]
[2, 4]
[3, 3]
[3, 4]
[4, 4]