[Numpy-discussion] permutation and array subsets

Serge Rey serge at rohan.sdsu.edu
Tue Aug 7 23:38:30 CDT 2001


i'm trying to use the results of permutation (from RandomArray.py) to
reorder the rows of an array:

>>> r=arange(20)
>>> id=permutation(20)
>>> y=r[id]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  IndexError: invalid index
  >>> 

i can use a for loop to permutate the ordering of r, but that has a
speed hit associated with it.  can anyone offer a suggestion for a way
to do this more efficiently? 

thanks,
serge
-- 
Sergio J. Rey	http://typhoon.sdsu.edu/rey.html




More information about the Numpy-discussion mailing list