Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Eelco Hoogendoorn
slightly OT; but fwiw, its all ill-thought out nonsense from the start anyway. ALL numbers satisfy the predicate 0*x=0. what the IEEE calls 'not a number' would be more accurately called 'not a specific number', or 'a number'. whats a logical negation among computer scientists? On Fri, Oct 3, 201

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 11:56 PM, Sturla Molden wrote: > Robert Kern wrote: > >> Yes, but that would require rewriting much of numpy.random to allow >> replacing the core generator. This would work out-of-box because it's >> just manipulating the state of the current core generator. > > Yes, then

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Charles R Harris
On Thu, Oct 2, 2014 at 10:12 PM, Charles R Harris wrote: > > > On Thu, Oct 2, 2014 at 9:29 PM, Nathaniel Smith wrote: > >> On Fri, Oct 3, 2014 at 3:20 AM, Charles R Harris >> wrote: >> > >> > On Thu, Oct 2, 2014 at 7:06 PM, Benjamin Root wrote: >> >> >> >> Out[1] has an integer divided by an i

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Charles R Harris
On Thu, Oct 2, 2014 at 9:29 PM, Nathaniel Smith wrote: > On Fri, Oct 3, 2014 at 3:20 AM, Charles R Harris > wrote: > > > > On Thu, Oct 2, 2014 at 7:06 PM, Benjamin Root wrote: > >> > >> Out[1] has an integer divided by an integer, and you can't represent nan > >> as an integer. Perhaps somethin

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Nathaniel Smith
On Fri, Oct 3, 2014 at 3:20 AM, Charles R Harris wrote: > > On Thu, Oct 2, 2014 at 7:06 PM, Benjamin Root wrote: >> >> Out[1] has an integer divided by an integer, and you can't represent nan >> as an integer. Perhaps something weird was happening with type promotion >> between versions? > > > Al

Re: [Numpy-discussion] Round away from zero (towards +/- infinity)

2014-10-02 Thread John Zwinck
On 3 Oct 2014 07:09, "T J" wrote: > > Any bites on this? > > On Wed, Sep 24, 2014 at 12:23 PM, T J wrote: >> Python's round function goes away from zero, so I am looking for the NumPy equivalent (and using vectorize() seems undesirable). In this sense, it seems that having a ufunc for this type o

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Charles R Harris
On Thu, Oct 2, 2014 at 7:06 PM, Benjamin Root wrote: > Out[1] has an integer divided by an integer, and you can't represent nan > as an integer. Perhaps something weird was happening with type promotion > between versions? > Also note that in python3 the '/' operator does float rather than integ

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Benjamin Root
Out[1] has an integer divided by an integer, and you can't represent nan as an integer. Perhaps something weird was happening with type promotion between versions? Ben Root On Oct 2, 2014 7:02 PM, "T J" wrote: > Hi, I'm using NumPy 1.8.2: > > In [1]: np.array(0) / np.array(0) > Out[1]: 0 > > In

[Numpy-discussion] Problem building 64 bit numpy using MKL on Windows

2014-10-02 Thread Reynolds, Jay
Hi, I've built numpy 64 bit using vc11, the Intel Fortran compiler and the MKL 'mkl_rt' library. *why? (see end of message for the reason, if interested) Any advice or assistance would be greatly appreciated. If I can offer additional information, I will happily do so. The build appears to g

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Jaime Fernández del Río
On Thu, Oct 2, 2014 at 4:29 PM, Charles R Harris wrote: > > > On Thu, Oct 2, 2014 at 5:02 PM, T J wrote: > >> Hi, I'm using NumPy 1.8.2: >> >> In [1]: np.array(0) / np.array(0) >> Out[1]: 0 >> >> In [2]: np.array(0) / np.array(0.0) >> Out[2]: nan >> >> In [3]: np.array(0.0) / np.array(0) >>

Re: [Numpy-discussion] 0/0 == 0?

2014-10-02 Thread Charles R Harris
On Thu, Oct 2, 2014 at 5:02 PM, T J wrote: > Hi, I'm using NumPy 1.8.2: > > In [1]: np.array(0) / np.array(0) > Out[1]: 0 > > In [2]: np.array(0) / np.array(0.0) > Out[2]: nan > > In [3]: np.array(0.0) / np.array(0) > Out[3]: nan > > In

Re: [Numpy-discussion] Round away from zero (towards +/- infinity)

2014-10-02 Thread T J
Any bites on this? On Wed, Sep 24, 2014 at 12:23 PM, T J wrote: > Is there a ufunc for rounding away from zero? Or do I need to do > > x2 = sign(x) * ceil(abs(x)) > > whenever I want to round away from zero? Maybe the following is better? > > x_ceil = ceil(x) > x_floor = floor(x) >

[Numpy-discussion] 0/0 == 0?

2014-10-02 Thread T J
Hi, I'm using NumPy 1.8.2: In [1]: np.array(0) / np.array(0) Out[1]: 0 In [2]: np.array(0) / np.array(0.0) Out[2]: nan In [3]: np.array(0.0) / np.array(0) Out[3]: nan In [4]: np.array(0.0) / np.array(0.0) Out[4]: nan In [5]: 0/0 --

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Sturla Molden
Robert Kern wrote: > Yes, but that would require rewriting much of numpy.random to allow > replacing the core generator. This would work out-of-box because it's > just manipulating the state of the current core generator. Yes, then we just need to sacrifice a year's worth of CPU time, and a PR w

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Brad Buran
Thanks for the great input. The idea of implementing jump-ahead in numpy.random would be a very nice feature, but I don't currently have the time to work on implementing such a feature. For now, it seems the simplest approach is to cache the RandomState and reuse that later. Brad On Thu, Oct 2,

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 9:52 PM, Sturla Molden wrote: > Robert Kern wrote: > >> No one needs small jumps of arbitrary size. The real use case for >> jumping is to make N parallel streams that won't overlap. You pick a >> number, let's call it `jump_steps`, much larger than any single run of >> you

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Sturla Molden
Robert Kern wrote: > No one needs small jumps of arbitrary size. The real use case for > jumping is to make N parallel streams that won't overlap. You pick a > number, let's call it `jump_steps`, much larger than any single run of > your system could possibly consume (i.e. the number of core PRNG

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 5:28 PM, Nathaniel Smith wrote: > On 2 Oct 2014 16:52, "Robert Kern" wrote: >> >> On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: >> > Given the following: >> > >> > from numpy import random >> > rs = random.RandomState(seed=1) >> > # skip the first X billion samples >>

Re: [Numpy-discussion] Interpolation using `np.interp()` with periodic x-coordinates (Saullo Castro)

2014-10-02 Thread Saullo Castro
aniel Smith > Subject: Re: [Numpy-discussion] skip samples in random number > generator > To: Discussion of Numerical Python > Message-ID: > < > capjvwbmzbqu-nyo1se6scvn+6eotw9mrzruwdkkuf188bgf...@mail.gmail.com> > Content-Type: text/plain; charset=&

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Nathaniel Smith
On 2 Oct 2014 16:52, "Robert Kern" wrote: > > On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: > > Given the following: > > > > from numpy import random > > rs = random.RandomState(seed=1) > > # skip the first X billion samples > > x = rs.uniform(0, 10) > > > > How do I accomplish "skip the firs

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: > Given the following: > > from numpy import random > rs = random.RandomState(seed=1) > # skip the first X billion samples > x = rs.uniform(0, 10) > > How do I accomplish "skip the first X billion samples" (e.g. 7.2 > billion)? I see that there's

[Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Brad Buran
Given the following: from numpy import random rs = random.RandomState(seed=1) # skip the first X billion samples x = rs.uniform(0, 10) How do I accomplish "skip the first X billion samples" (e.g. 7.2 billion)? I see that there's a numpy.random.RandomState.set_state which accepts (among other par

Re: [Numpy-discussion] Proposal: add ndarray.keys() to return dtype.names

2014-10-02 Thread John Zwinck
On Thu, Oct 2, 2014 at 6:27 PM, Sebastian Wagner wrote: > So, for non-structured arrays, the consens is an Exception. The question > is, which one. > AttributeError would be fully backwards compatible. Existing code checks > for the method and if it exists, the object has fields. > ValueError woul

Re: [Numpy-discussion] Proposal: add ndarray.keys() to return dtype.names

2014-10-02 Thread Sebastian Wagner
So, for non-structured arrays, the consens is an Exception. The question is, which one. AttributeError would be fully backwards compatible. Existing code checks for the method and if it exists, the object has fields. ValueError would make more sense, as the value - the array - is in wrong format/st