nd_iterator

odl.util.utility.nd_iterator(shape)[source]

Iterator over n-d cube with shape.

Parameters
shapesequence of int

The number of points per axis

Returns
nd_iteratorgenerator

Generator returning tuples of integers of length len(shape).

Examples

>>> for pt in nd_iterator([2, 2]):
...     print(pt)
(0, 0)
(0, 1)
(1, 0)
(1, 1)