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
complex ldexp #32336
base: master
Are you sure you want to change the base?
complex ldexp #32336
Conversation
Rather not define for a subset of parameters for `Complex` to allow for user defined types `<:Number`
Modified ldexp tests from base/math
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.
Neither C++ nor numpy seem to support complex ldexp
- can you find out why that is?
@@ -172,6 +176,55 @@ end | |||
end | |||
end | |||
|
|||
@testset "complex ldexp" begin | |||
@testset "Complex{$T}" for F in (Float16,Float32,Float64) |
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.
I'm not sure it's worth just copying the tests from the the float versions of ldexp
wholesale, given that the implementations are tightly coupled. It might be better just to test a few examples, given that complex ldexp inherits its behavior directly from the float version.
I think And I will update the tests hopefully soon. |
Sure, I'm just wondering if numpy did this on purpose; they do state very explicitly/authoritatively in their documentation that "Complex dtypes are not supported, they will raise a TypeError.". Ok, so after digging into the numpy history, it appears there's no good reason for this. Travis Oliphant added ldexp for normal floats way back in numpy/numpy@d91b5b9. The documentation eventually caught up in numpy/numpy@87fa5ae. The answer could very well be "it was annoying to add to the C code so nobody bothered" :-) |
Defining
ldexp
for complex type as a map over individual elements