Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: complex special case for clip #15643

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

BUG: complex special case for clip #15643

wants to merge 4 commits into from

Conversation

birm
Copy link

@birm birm commented Feb 25, 2020

Fixes #15630
Continues #15640

For now, I've just removed tests that didn't work with the clip. I'll re-add and fix them if this is judged to be useful.

@birm birm closed this Feb 25, 2020
@birm birm reopened this Feb 25, 2020
@charris charris added 00 - Bug component: numpy._core triage review Issue/PR to be discussed at the next triage meeting labels Feb 25, 2020
@charris
Copy link
Member

charris commented Feb 25, 2020

This is a big change in behavior, OTOH, I can't see anybody relying on the previous behavior :)

@seberg I've tagged this for triage.

@seberg
Copy link
Member

seberg commented Feb 26, 2020

Clip uses minimum and maximum for the 1 parameter version, so I doubt that this covers that part. If nobody relies on it, might as well go through a short futurewarning?
I am unsure I like defining clip to deviate from min/max, but the main issue around it is the fallback to minimum/maximum which we currently use and practically enforces symmetry.

@birm
Copy link
Author

birm commented Feb 26, 2020

It wasn't mentioned as a recommended option in the base issue, but maybe just warning on use of clip with complex input is sufficient.

@mattip
Copy link
Member

mattip commented Feb 26, 2020

Is there a actual use case for this? In any case it seems the consensus is for the behaviour to box-clip (separately clip real and imaginary) without touching min/max: the ufunc should not re-use max and min. In any case the proposal should be discussed on the mailing list.

@mattip mattip added triaged Issue/PR that was discussed in a triage meeting and removed triage review Issue/PR to be discussed at the next triage meeting labels Feb 26, 2020
@rgommers
Copy link
Member

Thanks @birm, test cases look fine to me.

Base automatically changed from master to main March 4, 2021 02:04
@charris
Copy link
Member

charris commented Apr 12, 2021

@birm Needs a release note, see doc/release/upcoming_changes for examples. This probably needs two entries, one for compatibility, and another for new_feature. The docstring for fromnumeric.clip also needs updating with a .. versionchanged:: note. In particular, the way to specify the box in the complex case needs explanation.

@charris charris added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Apr 12, 2021
@eric-wieser
Copy link
Member

Did we ever decide we actually wanted this? My understanding was we were only able to justify it if we deprecated the comparison on complex numbers which the current behavior is consistent with. Have we done that?

@seberg
Copy link
Member

seberg commented Apr 13, 2021

No, there is a bit of a net of dependencies. Comparison is used in sorting. For sorting we have a solution (i.e. we can add a "sortkey", the code for which is mostly ready). I think my main problem was that np.minimum and np.maximum should probably also be deprecated with that. Which may be OK, but there is no obvious replacement for them.

@charris
Copy link
Member

charris commented Jun 9, 2022

@birm Needs a rebase. I don't see any reason not to put this in.

@birm
Copy link
Author

birm commented Jun 15, 2022

Trying to fix my messes, as ever. I'm not opposed to maintainer changes, but I'll try to fix the tests as best as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes component: numpy._core triaged Issue/PR that was discussed in a triage meeting
Projects
Status: Pending authors' response
Development

Successfully merging this pull request may close these issues.

np.clip with complex input is untested and has odd behavior
6 participants