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

Deprecate vectorized imag methods in favor of compact broadcast syntax #18566

Closed
wants to merge 1 commit into from

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Sep 18, 2016

This PR deprecates all remaining vectorized imag methods (apart from those for SparseVectors, 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 vectorized imag methods never alias their input. This PR should be less controversial than #18495, #18512, and #18513 as a result.)

elseif which == "SI"
dmap = x->-imag(x)
dmap = x -> (-).(imag.(x))
Copy link
Contributor

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?

Copy link
Member Author

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!

Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member Author

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!

Copy link
Member Author

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!

@Sacha0
Copy link
Member Author

Sacha0 commented Dec 24, 2016

Closing per discussion in #18495 (comment). Best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broadcast Applying a function over a collection complex Complex numbers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants