Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Janikas
ces] >> >> t=timeit.Timer("weirdshuffle4(x,ny)", "from __main__ import *") >> print t.timeit(100) >> >> 0.0148663153873 >> >> >> -Original Message- >> From: numpy-discussion-boun...@scipy.org >> [mailto:numpy-discussion-bo

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
t=timeit.Timer("weirdshuffle4(x,ny)", "from __main__ import *") >> print t.timeit(100) >> >> 0.0148663153873 >> >> >> -Original Message- >> From: numpy-discussion-boun...@scipy.org >> [mailto:numpy-discussion-boun...@scipy.

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread josef . pktd
> Sent: Tuesday, February 10, 2009 12:59 PM > To: Discussion of Numerical Python > Subject: Re: [Numpy-discussion] Permutations in Simulations` > > On Tue, Feb 10, 2009 at 12:41 PM, Keith Goodman wrote: >> On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman >> wrote: >>>

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Janikas
Tuesday, February 10, 2009 12:59 PM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Permutations in Simulations` On Tue, Feb 10, 2009 at 12:41 PM, Keith Goodman wrote: > On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman wrote: >> On Tue, Feb 10, 2009 at 12:18 PM, Kei

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Miller
Got it. Thanks! On Tue, Feb 10, 2009 at 1:50 PM, Keith Goodman wrote: > On Tue, Feb 10, 2009 at 1:41 PM, Mark Miller > wrote: >> Out of curiosity, why wouldn't numpy.apply_along_axis be a reasonable >> approach here. Even more curious: why is it slower than the original >> explicit loop? > >

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
On Tue, Feb 10, 2009 at 1:41 PM, Mark Miller wrote: > Out of curiosity, why wouldn't numpy.apply_along_axis be a reasonable > approach here. Even more curious: why is it slower than the original > explicit loop? I took a quick look at the apply_along_axis code. It is numpy code (not c) and it u

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Miller
Out of curiosity, why wouldn't numpy.apply_along_axis be a reasonable approach here. Even more curious: why is it slower than the original explicit loop? Learning, -Mark import numpy as np import timeit def baseshuffle(nx, ny): x = np.arange(nx) res = np.zeros((nx,ny),int) for sim

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
On Tue, Feb 10, 2009 at 12:41 PM, Keith Goodman wrote: > On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman wrote: >> On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote: >>> On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote: I want to create an array that contains a column of permutatio

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman wrote: > On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote: >> On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote: >>> I want to create an array that contains a column of permutations for each >>> simulation: >>> >>> import numpy as NUM >>> >

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote: > On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote: >> I want to create an array that contains a column of permutations for each >> simulation: >> >> import numpy as NUM >> >> import numpy.random as RAND >> >> x = NUM.arange(4.) >> >> res

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Keith Goodman
On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote: > I want to create an array that contains a column of permutations for each > simulation: > > import numpy as NUM > > import numpy.random as RAND > > x = NUM.arange(4.) > > res = NUM.zeros((4,100)) > > > for sim in range(100): > > res[:,sim] =

[Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Janikas
Hello All, I want to create an array that contains a column of permutations for each simulation: import numpy as NUM import numpy.random as RAND x = NUM.arange(4.) res = NUM.zeros((4,100)) for sim in range(100): res[:,sim] = RAND.permutation(x) Is there a way to do this without a loop? Thank