AMICI-dev / AMICI

Advanced Multilanguage Interface to CVODES and IDAS
https://amici.readthedocs.io/
Other
108 stars 31 forks source link

Make is-zero-checks compatible with the upcoming sympy>1.12 #2350

Closed dweindl closed 7 months ago

dweindl commented 7 months ago

Current sympy master (tested: 0ededfcfc033ddca2d1d54a0eda85bf53c63761c):

IPython console for SymPy 1.13.dev (Python 3.12.2-64-bit) (ground types: python)
In [1]: Float(0) == 0
Out[1]: False
In [2]: Float(0).is_zero
Out[2]: True

vs 1.12:

Python console for SymPy 1.12 (Python 3.12.2-64-bit) (ground types: python)
>>> Float(0) == 0
True
>>> Float(0).is_zero
True

Therefore, replace == 0 by .is_zero.

Amongst other potential issues, this fixes zeros in sparse matrices. Closes #2320.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.94%. Comparing base (2235ab7) to head (d3e069e).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/graphs/tree.svg?width=650&height=150&src=pr&token=1bt9lbspzk&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev)](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) ```diff @@ Coverage Diff @@ ## develop #2350 +/- ## =========================================== + Coverage 77.86% 77.94% +0.07% =========================================== Files 324 324 Lines 20731 20731 Branches 1449 1449 =========================================== + Hits 16143 16159 +16 + Misses 4585 4569 -16 Partials 3 3 ``` | [Flag](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | Coverage Δ | | |---|---|---| | [cpp](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `73.74% <100.00%> (+0.07%)` | :arrow_up: | | [cpp_python](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `34.34% <100.00%> (ø)` | | | [petab](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `36.86% <66.66%> (ø)` | | | [python](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `72.52% <100.00%> (+0.07%)` | :arrow_up: | | [sbmlsuite](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `?` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | Coverage Δ | | |---|---|---| | [python/sdist/amici/cxxcodeprinter.py](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev#diff-cHl0aG9uL3NkaXN0L2FtaWNpL2N4eGNvZGVwcmludGVyLnB5) | `90.19% <100.00%> (ø)` | | | [python/sdist/amici/de\_model.py](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev#diff-cHl0aG9uL3NkaXN0L2FtaWNpL2RlX21vZGVsLnB5) | `92.63% <100.00%> (ø)` | | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2350/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev)