BUG interp wrong if input xp isn't sorted
Open
Nobody has claimed this yet.
component: numpy.lib
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
MWE:
import numpy
xp = [0.0, 1.0]
fp = [0.2, 0.3]
print(numpy.interp(0.5, xp, fp)) # 0.25, correct
xp = [1.0, 0.0]
fp = [0.3, 0.2]
print(numpy.interp(0.5, xp, fp)) # 0.2, WRONG
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the numpy.interp entry point and reproduce the issue's MWE with ascending and descending xp. Inspect how xp ordering is handled and determine the intended behavior for unsorted input from the surrounding implementation and discussion. Done means the behavior is consistent for the reported case and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100