Re: [Numpy-discussion] in place random generation

2007-03-19 Thread Charles R Harris
On 3/19/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Mark P. Miller wrote: >Robert: Just a thought on this topic: > >Would it be possible for the Scipy folks to add a new module based >solely off your old mtrand code (pre-broadcast)? I have to say that the >mtrand code from numpy 0.9.8 has

Re: [Numpy-discussion] in place random generation

2007-03-19 Thread Robert Kern
Travis Oliphant wrote: > I've just added a faster path through the random-number generators for > scalar parameters to the SVN code tree. > > It would be great if those who use this could check to see if > > 1) it is correct > 2) it is indeed faster for scalar parameters It's faster, certainly.

Re: [Numpy-discussion] in place random generation

2007-03-19 Thread Travis Oliphant
Mark P. Miller wrote: >Robert: Just a thought on this topic: > >Would it be possible for the Scipy folks to add a new module based >solely off your old mtrand code (pre-broadcast)? I have to say that the >mtrand code from numpy 0.9.8 has some excellent advantages over the core >python random

Re: [Numpy-discussion] in place random generation

2007-03-14 Thread Travis Oliphant
Charles R Harris wrote: > > > On 3/14/07, *Daniel Mahler* <[EMAIL PROTECTED] > > wrote: > > On 3/12/07, Travis Oliphant <[EMAIL PROTECTED] > > wrote: > > > I'm not convinced that the broadcasting is causing the slow-downs. > > Cur

Re: [Numpy-discussion] in place random generation

2007-03-14 Thread Charles R Harris
On 3/14/07, Daniel Mahler <[EMAIL PROTECTED]> wrote: On 3/12/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > I'm not convinced that the broadcasting is causing the slow-downs. > Currently, the code has two path-ways. One gets called when the inputs > are scalars which is equivalent to the old

Re: [Numpy-discussion] in place random generation

2007-03-14 Thread Daniel Mahler
On 3/12/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > I'm not convinced that the broadcasting is causing the slow-downs. > Currently, the code has two path-ways. One gets called when the inputs > are scalars which is equivalent to the old code and the second gets > called when broadcasting is

Re: [Numpy-discussion] in place random generation

2007-03-13 Thread Travis Oliphant
Mark P. Miller wrote: >Robert: Just a thought on this topic: > >Would it be possible for the Scipy folks to add a new module based >solely off your old mtrand code (pre-broadcast)? I have to say that the >mtrand code from numpy 0.9.8 has some excellent advantages over the core >python random

Re: [Numpy-discussion] in place random generation

2007-03-10 Thread Robert Kern
Mark P. Miller wrote: > Robert: Just a thought on this topic: > > Would it be possible for the Scipy folks to add a new module based > solely off your old mtrand code (pre-broadcast)? I have to say that the > mtrand code from numpy 0.9.8 has some excellent advantages over the core > python ra

Re: [Numpy-discussion] in place random generation

2007-03-10 Thread Mark P. Miller
Robert: Just a thought on this topic: Would it be possible for the Scipy folks to add a new module based solely off your old mtrand code (pre-broadcast)? I have to say that the mtrand code from numpy 0.9.8 has some excellent advantages over the core python random number generators. This woul

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Matthew Brett
Oh dear, sorry, I should have read your email more carefully. Matthew On 3/8/07, Daniel Mahler <[EMAIL PROTECTED]> wrote: > On 3/8/07, Matthew Brett <[EMAIL PROTECTED]> wrote: > > > > My problem is not space, but time. > > > > I am creating a small array over and over, > > > > and this is turning

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Robert Kern
Anne Archibald wrote: > On 09/03/07, Robert Kern <[EMAIL PROTECTED]> wrote: >> Mark P. Miller wrote: >>> As an aside, are the random number generators from scipy.random the same >>> as those for numpy.random? If not, will those of us who need to just >>> use a few random numbers here and there thr

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Robert Kern
Mark P. Miller wrote: > Robert Kern wrote: > > scipy.random is not a package. scipy/__init__.py does a "from numpy > import *" > > and thus pulls in numpy.random. > > Got it...and one more question: > > What about using something like > from numpy.random import mtrand > > And then using mtran

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Mark P. Miller
Robert Kern wrote: > scipy.random is not a package. scipy/__init__.py does a "from numpy import *" > and thus pulls in numpy.random. > Got it...and one more question: What about using something like from numpy.random import mtrand And then using mtrand.seed and mtrand.normal in code? Would

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Anne Archibald
On 09/03/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Mark P. Miller wrote: > > As an aside, are the random number generators from scipy.random the same > > as those for numpy.random? If not, will those of us who need to just > > use a few random numbers here and there throughout our code (we don'

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Robert Kern
Mark P. Miller wrote: > As an aside, are the random number generators from scipy.random the same > as those for numpy.random? If not, will those of us who need to just > use a few random numbers here and there throughout our code (we don't > need arrays of random numbers or broadcasting abiliti

Re: [Numpy-discussion] in place random generation

2007-03-09 Thread Mark P. Miller
This discussion has much in common with a previous thread that I started ("When and where to use Numpy..."). I fully admit to being a naive numpy user, but it seems to me that it would be helpful if the documentation provided some explicit statements to inform potential users about the best typ

Re: [Numpy-discussion] in place random generation

2007-03-08 Thread Anne Archibald
On 08/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > For normals this seems overkill as the same result can be achieved by an > offset and scale, i.e., if r is an array of random numbers with mean 0 and > sigma 1, then > > myrandomarray = (r*mysigma + mymean) > > easily achieves the same res

Re: [Numpy-discussion] in place random generation

2007-03-08 Thread Charles R Harris
On 3/8/07, Robert Kern <[EMAIL PROTECTED]> wrote: Daniel Mahler wrote: > On 3/8/07, Charles R Harris <[EMAIL PROTECTED]> wrote: >> Robert thought this might relate to Travis' changes adding broadcasting to >> the random number generator. It does seem certain that generating small >> arrays of r

Re: [Numpy-discussion] in place random generation

2007-03-08 Thread Robert Kern
Daniel Mahler wrote: > On 3/8/07, Charles R Harris <[EMAIL PROTECTED]> wrote: >> Robert thought this might relate to Travis' changes adding broadcasting to >> the random number generator. It does seem certain that generating small >> arrays of random numbers has a very high overhead. > > Does tha

Re: [Numpy-discussion] in place random generation

2007-03-08 Thread Daniel Mahler
On 3/8/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > The slow down is probably related to this from a previous thread: > > In [46]: def test1() : >: x = normal(0,1,1000) >: > > In [47]: def test2() : >: for i in range(1000) : >: x = normal(0,1) >

Re: [Numpy-discussion] in place random generation

2007-03-08 Thread Daniel Mahler
On 3/8/07, Matthew Brett <[EMAIL PROTECTED]> wrote: > > > My problem is not space, but time. > > > I am creating a small array over and over, > > > and this is turning out to be a bottleneck. > > How about making one large random number array and taking small views? > How is that different from:

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Charles R Harris
On 3/7/07, Daniel Mahler <[EMAIL PROTECTED]> wrote: My problem is not space, but time. I am creating a small array over and over, and this is turning out to be a bottleneck. My experiments suggest that problem is the allocation, not the random number generation. Allocating all the arrays as one

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Matthew Brett
> > My problem is not space, but time. > > I am creating a small array over and over, > > and this is turning out to be a bottleneck. How about making one large random number array and taking small views? Matthew ___ Numpy-discussion mailing list Numpy-

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Anne Archibald
On 07/03/07, Daniel Mahler <[EMAIL PROTECTED]> wrote: > My problem is not space, but time. > I am creating a small array over and over, > and this is turning out to be a bottleneck. > My experiments suggest that problem is the allocation, > not the random number generation. > Allocating all the arr

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Daniel Mahler
My problem is not space, but time. I am creating a small array over and over, and this is turning out to be a bottleneck. My experiments suggest that problem is the allocation, not the random number generation. Allocating all the arrays as one n+1 dim and grabbing rows from it is faster than alloc

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Timothy Hochberg
On 3/7/07, Robert Kern <[EMAIL PROTECTED]> wrote: Daniel Mahler wrote: > Is there an efficient way to fill an existing array with random > numbers without allocating a new array? No, sorry. There is however an only moderately inefficient way if you are primarily concerned with keeping your t

Re: [Numpy-discussion] in place random generation

2007-03-07 Thread Robert Kern
Daniel Mahler wrote: > Is there an efficient way to fill an existing array with random > numbers without allocating a new array? No, sorry. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it a

[Numpy-discussion] in place random generation

2007-03-07 Thread Daniel Mahler
Is there an efficient way to fill an existing array with random numbers without allocating a new array? thanks Daniel ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion