-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
MAINT: logsumexp: properly handle complex sign #19870
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
Conversation
cd37912
to
bcf3ffc
Compare
dd5a305
to
f885d1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! In-line a comment about whether we should just use the "correct" sign all the time, but since what you have gives exactly the same answer, either route is fine.
p.s. Like your numpy-version-agnostic test!
f885d1f
to
423621b
Compare
Updated based on discussion in #19854 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this more, one wonders whether this function really makes sense for complex, but some comments in-line about it. Only first one about a_max
is important.
0b8069c
to
6c293fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's one more suggested change (I had it as a pending comment for about a week it seems...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #19854
I opted to have
logsumexp
return a sign that matches the convention ofnp.sign
for whichever numpy version is installed.