-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
ENH: cinfo()
for inspecting complex dtypes OR formalise/document complex dtype behaviour in finfo()
#22260
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
Comments
Like @kgryte said in the issue that you linked, it doesn't make sense to have a max, min, or eps for a complex number. Having a max or min for the real and imaginary components wouldn't work either, since the max and min are the same for both components. Changing the docs would probably be better. |
|
There was some confusion about how finfo works with complex numbers, leading to an issue being made requesting that numpy either adds a cinfo function or changes the documentation of finfo. The submitter of that issue also linked to an issue for a seperate repository, which also included conversation about the proposed change. (github.com/data-apis/array-api/issues/433) In both discussions, there was a general concensus that it would be better to change the documentation to explain how finfo works instead of creating a cinfo function. Since this is just a small documentation change, there's no need to run the normal checks. [skip ci]
DOC: Clarified how finfo works with complex numbers (#22260)
Closing as #22263 (comment) has been merged, which documents complex dtype behaviour in |
Proposed new feature or change:
Currently we can use
finfo()
to get useful information for a single component (i.e. real or imag).A downside is this feels a bit too implicit, but maybe more importantly is that this isn't documented behaviour (see
finfo
docs).For ints we have
iinfo()
and floats we havefinfo()
, so how about acinfo()
for complex dtypes? There's an issue for the Array API for such a feature, which has some discussion on what the return info object could actually look like data-apis/array-api#433.I think the biggest question with a "complex info object" is if it were to have separate attributes per real and imaj components, or just attributes which pertain to both. As the components should always work the same, I would prefer attributes that pertain to both... but as it'd look identical to an
finfo()
-returned object, personally I'd prefer just having document support of complex dtypes infinfo()
.In any case, a formal way of finding info about the real/imag components of complex dtypes would be nice. I came across this need recently when experimenting with complex number support for
hypothesis.extra.array_api
, where we could easily grab useful info for ints and floats but not for complex numbers, resulting in an preliminary step to infer the relevant float representation of the complex components... I mean not the worst thing in the world, but just didn't feel good! 😅
The text was updated successfully, but these errors were encountered: