-
Notifications
You must be signed in to change notification settings - Fork 594
Migrate to SciPy sparse arrays #3613
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
base: develop
Are you sure you want to change the base?
Conversation
|
I guess another option is to change the pyproject.toml to ensure scipy 1.115.0 or newer is installed. |
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.
Looks pretty good to me and I like the compatibility module. Is the plan to eliminate this and go back to pure scipy imports when we drop support for scipy 1.14 this coming year? Also, there is some use of csr_matrix in the cmfd module as well as lil_matrix in tallies.py that should be addressed in this PR as well.
|
@eepeterson Correct, at the appropriate point we'll drop the compatibility module and just use the sparse array classes directly from scipy. Also thanks for pointing out those ones I missed in cmfd.py and tallies.py! Those have been updated now. |
|
Changes in cmfd.py look good to me 👍🏾 |
Description
In recent versions of scipy, they have introduced sparse arrays (e.g.,
csc_array) that generalize the existing sparse matrix classes to N dimensions. The scipy documentation recommends migrating to using sparse arrays rather than sparse matrices. This PR completes that migration for OpenMC, preferentially using sparse arrays for scipy 1.15+ (when they became fully supported) and falling back to sparse matrices for earlier versions.Checklist
I have run clang-format (version 15) on any C++ source files (if applicable)