numpy.ix

numpy.ix_(*args)

Construct an open mesh from multiple sequences.

This function takes n 1-d sequences and returns n outputs with n dimensions each such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all n dimensions.

Using ix_() one can quickly construct index arrays that will index the cross product.

a[ix_([1,3,7],[2,5,8])] returns the array

a[1,2] a[1,5] a[1,8] a[3,2] a[3,5] a[3,8] a[7,2] a[7,5] a[7,8]

Previous topic

numpy.indices

Next topic

numpy.ogrid

This Page

Quick search