Migrate to SciPy sparse arrays#3613
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.
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 👍🏾 |
The review's feedback was addressed.
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)