Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 12:00 PM, Charles R Harris wrote: > > > On Wed, Jun 5, 2013 at 11:59 AM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith wrote: >> >>> On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor >>> wrote: >>> > On 05.0

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 11:59 AM, Charles R Harris wrote: > > > On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith wrote: > >> On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor >> wrote: >> > On 05.06.2013 16:33, Nathaniel Smith wrote: >> >> The slow down people are worried about is, suppose that 'xp'

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith wrote: > On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor > wrote: > > On 05.06.2013 16:33, Nathaniel Smith wrote: > >> The slow down people are worried about is, suppose that 'xp' has > >> 1,000,000 entries, and the user wants to interpolate 1 point

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor wrote: > On 05.06.2013 16:33, Nathaniel Smith wrote: >> The slow down people are worried about is, suppose that 'xp' has >> 1,000,000 entries, and the user wants to interpolate 1 point. If we >> can assume the array is sorted, then we can find which bi

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Julian Taylor
On 05.06.2013 16:33, Nathaniel Smith wrote: > On Wed, Jun 5, 2013 at 3:16 PM, Slavin, Jonathan > wrote: >> The simplest monotonicity test that I've seen is: >> >> dx = np.diff(x) >> monotonic = np.all(dx < 0.) or np.all(dx > 0.) >> >> I expect that this is pretty fast, though I haven't tested it y

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On Wed, Jun 5, 2013 at 3:16 PM, Slavin, Jonathan wrote: > The simplest monotonicity test that I've seen is: > > dx = np.diff(x) > monotonic = np.all(dx < 0.) or np.all(dx > 0.) > > I expect that this is pretty fast, though I haven't tested it yet. If we > want to make checking optional, then I th

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Slavin, Jonathan
o skip the check. Jon On Tue, Jun 4, 2013 at 9:03 PM, wrote: > From: Eric Firing > To: numpy-discussion@scipy.org > Cc: > Date: Tue, 04 Jun 2013 15:08:29 -1000 > Subject: Re: [Numpy-discussion] suggested change of behavior for interp > On 2013/06/04 2:05 PM, Charles R Harr

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On 5 Jun 2013 03:21, "Eric Firing" wrote: > > On 2013/06/04 4:15 PM, Benjamin Root wrote: > > Could non-monotonicity be detected as part of the interp process? > > Perhaps a sign switch in the deltas? > > There are two code paths, depending on the number of points to be > interpolated. When it is

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Eric Firing
On 2013/06/04 4:15 PM, Benjamin Root wrote: > Could non-monotonicity be detected as part of the interp process? > Perhaps a sign switch in the deltas? There are two code paths, depending on the number of points to be interpolated. When it is greater than the size of the table, the deltas are pr

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Benjamin Root
Could non-monotonicity be detected as part of the interp process? Perhaps a sign switch in the deltas? I have been bitten by this problem too. Cheers! Ben Root On Jun 4, 2013 9:08 PM, "Eric Firing" wrote: > > On 2013/06/04 2:05 PM, Charles R Harris wrote: > > > > > > On Tue, Jun 4, 2013 at 12:0

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Eric Firing
On 2013/06/04 2:05 PM, Charles R Harris wrote: > > > On Tue, Jun 4, 2013 at 12:07 PM, Slavin, Jonathan > mailto:jsla...@cfa.harvard.edu>> wrote: > > Hi, > > I would like to suggest that the behavior of numpy.interp be changed > regarding treatment of situations in which the x-coordinate

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Charles R Harris
On Tue, Jun 4, 2013 at 12:07 PM, Slavin, Jonathan wrote: > Hi, > > I would like to suggest that the behavior of numpy.interp be changed > regarding treatment of situations in which the x-coordinates are not > monotonically increasing. Specifically, it seems to me that interp should > work correct

[Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Slavin, Jonathan
Hi, I would like to suggest that the behavior of numpy.interp be changed regarding treatment of situations in which the x-coordinates are not monotonically increasing. Specifically, it seems to me that interp should work correctly when the x-coordinate is decreasing monotonically. Clearly it can