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

Add imag specification for returning the imaginary component of a complex number #496

Merged
merged 2 commits into from
Nov 2, 2022

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Oct 17, 2022

This PR

@kgryte kgryte added the API extension Adds new functions or objects to the API. label Oct 17, 2022
@kgryte kgryte added this to the v2022 milestone Oct 17, 2022
@kgryte
Copy link
Contributor Author

kgryte commented Nov 2, 2022

As this is a straightforward addition and has already been discussed in consortium meetings, will merge. Any further revisions can be addressed in a subsequent PR.

@kgryte kgryte merged commit 3c0d3ee into main Nov 2, 2022
@kgryte kgryte deleted the add-imag branch November 2, 2022 07:17
Returns
-------
out: array
an array containing the element-wise results. The returned array must have a floating-point data type with the same floating-point precision as ``x`` (e.g., if ``x`` is ``complex64``, the returned array must have the floating-point data type ``float32``).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "must" or "should"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what scenarios should/would this not be the case? And why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my bad I was reading this as if it were the input array, not the output. I see the input does say "should".

Copy link
Contributor Author

@kgryte kgryte Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the input dtype, allowing array libraries to support real-valued dtypes makes sense in order to allow for backward compat; however, all array libraries should return an array having a dtype with the same precision.

I suppose you may be thinking if an array library supports real-valued int dtypes, would requiring a float dtype make sense, rather than a no-op or an array having an int dtype with the same precision?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants