class Phase::ColexIterator(I)

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.cr

Constructors

Instance Method Summary

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 I
cover(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.


[View source]
def self.new(region_literal : Indexable(I)) forall I #

Constructs an iterator that will provide every coordinate described by a region literal.


[View source]

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).


[View source]
def clone : self #

[View source]