[Numpy-discussion] suggested change of behavior for interp
Tue Jun 4 21:15:21 CDT 2013
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.
On Jun 4, 2013 9:08 PM, "Eric Firing" <firstname.lastname@example.org> wrote:
> On 2013/06/04 2:05 PM, Charles R Harris wrote:
> > On Tue, Jun 4, 2013 at 12:07 PM, Slavin, Jonathan
> > <email@example.com <mailto:firstname.lastname@example.org>> 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 correctly when the x-coordinate is decreasing
> > monotonically. Clearly it cannot work if the x-coordinate is not
> > monotonic, but in that case it should raise an exception. Currently
> > if x is not increasing it simply silently fails, providing incorrect
> > values. This fix could be as simple as a monotonicity test and
> > inversion if necessary (plus a raise statement for non-monotonic
> > Seems reasonable, although it might add a bit of execution time.
> The monotonicity test should be an option if it is available at all;
> when interpolating a small number of points from a large pair of arrays,
> the single sweep through the whole array could dominate the execution
> time. Checking for increasing versus decreasing, in contrast, can be
> done fast, so handling the decreasing case transparently is reasonable.
> > Chuck
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion