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

Refactor tests to use NumPy vectorized operations #26

Open
xhgchen opened this issue Aug 9, 2023 · 1 comment
Open

Refactor tests to use NumPy vectorized operations #26

xhgchen opened this issue Aug 9, 2023 · 1 comment

Comments

@xhgchen
Copy link
Member

xhgchen commented Aug 9, 2023

The characteristic polynomials testing the VelocityAutocorr class and the ViscosityHelfand class use for loops and could benefit from more vectorized operations in NumPy, as explained by @hmacdope i.e. we can set up entire arrays with the values beforehand and then perform the mathematical operations on the entire arrays with NumPy instead of looping through.

This is already done in the actual implementations in each of the classes. It would speed up the tests and potentially improve agreement between the expected test values and the actual implementation.

@hmacdope
Copy link
Member

hmacdope commented Aug 9, 2023

https://blog.paperspace.com/numpy-optimization-vectorization-and-broadcasting/ for a good visual introduction to vectorisaton and broadcasting.

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

No branches or pull requests

2 participants