[Numpy-discussion] Extracting all the possible combinations of a grid

Gael Varoquaux gael.varoquaux at normalesup.org
Fri Sep 21 15:19:59 EDT 2007


Hi all,

I want to generate all the possible triplets of integers in [0, n]. I am
wondering want the best possible way to do this is.

To make things clearer, I could generate i, j, k using indices:

i, j, k = indices((n, n, n))

But I will have several times the same triplet with different ordenings.
I am looking for a loop-free way of creating three arrays i, j, k with
all the triplets present once, and only once.

Any hint appreciated.

Cheers,

Gaël

PS: I am having problems with my mail, so excuse me if this is a dup



More information about the NumPy-Discussion mailing list