-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deprecate vectorized imag methods in favor of compact broadcast syntax #18566
Conversation
elseif which == "SI" | ||
dmap = x->-imag(x) | ||
dmap = x -> (-).(imag.(x)) |
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.
have or are we planning on deprecating vectorized unary minus for arrays?
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.
Not that I am aware of. Exploiting fusion was the objective above. Are you suggesting that we should consider deprecating vectorized unary minus? Best!
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.
No, no, I just forgot that fusion would make this worth doing. It looks funny is all.
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.
Quite funny it looks indeed :). Would imag.((-).(x))
look better to you?
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 think that map(t -> -imag(t), x)
is simpler to read in this case.
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.
That looks like a winking owl. The way you have it here gets rid of the real component before negating. Not sure if the compiler would elide negating the real component if you did it the other way around.
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.
Agreed, the explicit map is simple and clear. A similar compact broadcast form would be (t -> -imag(t)).(x)
. Preferences? Best!
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.
Switched to map(t -> -imag(t), x)
for now, but of course am happy to change to something else if need be. Thanks!
Closing per discussion in #18495 (comment). Best! |
This PR deprecates all remaining vectorized
imag
methods (apart from those forSparseVector
s, separate PR) in favor of compact broadcast syntax. Ref. #16285, #17302, #18495, #18512, #18513, #18558, and #18564. Best!(Unlike with
float
,real
, etc., the remaining vectorizedimag
methods never alias their input. This PR should be less controversial than #18495, #18512, and #18513 as a result.)