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

fix weighted computations for non-real arrays #649

Closed
wants to merge 1 commit into from
Closed

fix weighted computations for non-real arrays #649

wants to merge 1 commit into from

Conversation

aplavin
Copy link
Contributor

@aplavin aplavin commented Jan 27, 2021

This fixes #518 following suggestion from @nalimilan. The linked issue also contains a long discussion on the best approach, but looks like no decision and fix followed from there. So here I just take the simplest approach to make the computations correct.

@nalimilan
Copy link
Member

nalimilan commented Jan 27, 2021

Thanks. That discussion is indeed quite long. After reading it again, I think that the best solution is to use sum(Base.Broadcast.instantiate(Base.Broadcast.Broadcasted(*, (x, y)))) on Julia 1.4 and above for the generic, non-Real method (see #518 (comment)). The simplest approach is probably to restrict the dot methods you have in this PR to Real (or Number if they are faster for Complex than broadcasting), and use broadcast in the general case.

@andreasnoack
Copy link
Member

Superseded by #658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong weighted sum and mean results for complex numbers
3 participants