class
Phase::ColexIterator(I)
- Phase::ColexIterator(I)
- Phase::StrideIterator(I)
- Reference
- Object
Overview
An Iterator that produces every coordinate in an IndexRegion in colexicographic
(column-major) order. For example:
ColexIterator.cover([2, 3]).each.to_a # => [[0, 0], [1, 0], [0, 1], [1, 1], [0, 1], [1, 2]]
Defined in:
iterators/colex_iterator.crConstructors
-
.new(idx_r : IndexRegion(I))
Constructs an iterator that will provide every coordinate described by an
IndexRegion. -
.new(region_literal : Indexable(I)) forall I
Constructs an iterator that will provide every coordinate described by a region literal.
Instance Method Summary
-
#advance! : Array(I) | Stop
Advances the internal state of this
StrideIteratorand returns the new coord (orIterator::Stopif iteration is finished). - #clone : self
Instance methods inherited from class Phase::StrideIterator(I)
advance! : Array(I) | Stop
advance!,
largest_coord : Indexable(I) | Nil
largest_coord,
next : ReadonlyWrapper(Array(I), I) | Stop
next,
reset!
reset!,
reverse!
reverse!,
to_a : Array(Indexable(I))
to_a,
unsafe_next : Indexable(I)
unsafe_next
Constructor methods inherited from class Phase::StrideIterator(I)
new(idx_r : IndexRegion(I))new(region_literal : Indexable(I)) forall I new
Class methods inherited from class Phase::StrideIterator(I)
cover(shape : Indexable(I)) forall Icover(src : MultiIndexable) cover
Macros inherited from class Phase::StrideIterator(I)
def_standard_clone
def_standard_clone
Constructor Detail
def self.new(idx_r : IndexRegion(I))
#
Constructs an iterator that will provide every coordinate described by an IndexRegion.
def self.new(region_literal : Indexable(I)) forall I
#
Constructs an iterator that will provide every coordinate described by a region literal.
Instance Method Detail
def advance! : Array(I) | Stop
#
Description copied from class Phase::StrideIterator(I)
Advances the internal state of this StrideIterator and returns the new coord (or Iterator::Stop if iteration is finished).