8000 Replace _prod_vectorized by @-multiplication. by anntzer · Pull Request #15374 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Replace _prod_vectorized by @-multiplication. #15374

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

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Oct 3, 2019

@-multiplication has the exact same broadcasting behavior as
_prod_vectorized (...ij,...jk->...ik in einsum notation).
(It's not the same as for np.dot.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

dV = dV @ _extract_submatrices(
self.rotate_dV, subtri, block_size=2, axis=0)

prod = (self.M @ dV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we pay a performance hit for temporaries here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it‘s not in a tight loop, it can‘t be too bad. Anyway it‘s the same as before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I initially thought that the temporaries would be the same but that's not the case; even if I doubt this really matters performance-wise I restored the old form.

@-multiplication has the exact same broadcasting behavior as
_prod_vectorized (`...ij,...jk->...ik` in einsum notation).
Copy link
Member
@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems no reason not to merge this.

@QuLogic QuLogic added this to the v3.4.0 milestone Sep 9, 2020
@timhoffm timhoffm merged commit ec45ec7 into matplotlib:master Sep 10, 2020
@anntzer anntzer deleted the cleanup-tri branch September 10, 2020 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0