-
-
Notifications
You must be signed in to change notification settings - Fork 53
Replace np.sum(a * b)
with a @ b
for better performance and accuracy
#542
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
Conversation
…l, and mccall_model_with_separation Co-authored-by: mmcky <[email protected]>
Co-authored-by: mmcky <[email protected]>
np.sum(a * b)
versus a @ b
np.sum(a * b)
with a @ b
for better performance and accuracy
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.
Hi @mmcky,
I had a look over this PR. I think it introduces a bug to lake_model
.
Other than that, other changes are correct to me.
Hi @mmcky, I incorprated John's comments. I will merge this once it is built. Please let me know if you have further comments or changes you want to make! |
This PR replaces instances of
np.sum(a * b)
with the more efficienta @ b
operator throughout the lecture series, following best practices for NumPy operations.Changes Made
Educational Enhancement
lectures/linear_algebra.md: Added side-by-side comparison showing both methods:
Explains that
@
operator is preferred for performance and numerical accuracy.Direct Replacements
Benefits
Examples
Before:
After:
All changes preserve mathematical equivalence while improving performance through optimized linear algebra operations.
Fixes #463.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.