cf.Partition.ndindex

Partition.ndindex()[source]

Return an iterator over the N-dimensional indices of the partition’s data array.

At each iteration a tuple of indices is returned, the last dimension is iterated over first.

Returns :
out : generator

An iterator over indices of the partition’s data array.

Examples

>>> p.shape
[2, 1, 3]
>>> for index in p.ndindex():
...     print index
...
(0, 0, 0)
(0, 0, 1)
(0, 0, 2)
(1, 0, 0)
(1, 0, 1)
(1, 0, 2)
>>> p.shape
[]
>>> for index in p.ndindex():
...     print index
...
()

Previous topic

cf.Partition.master_ndindex

Next topic

cf.Partition.new_part

This Page