
8 Aug
2001
8 Aug
'01
4:38 a.m.
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

8 Aug
8 Aug
4:46 a.m.
Serge Rey wrote:
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]
Try:
y = take(r, permutation(len(r)))
Scott
--
Scott M. Ransom Address: Harvard-Smithsonian CfA
Phone: (617) 496-7908 60 Garden St. MS 10
email: ransom@cfa.harvard.edu Cambridge, MA 02138
GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989
7897
Age (days ago)
7897
Last active (days ago)
1 comments
2 participants
participants (2)
-
Scott Ransom
-
Serge Rey