Skip to content

Commit

Permalink
Skip unnecessary toposorting in DEModel._collect_heaviside_roots (#…
Browse files Browse the repository at this point in the history
…2299)

Sorting is only required if roots have been found. Most often this will not be the case.
Only sort when necessary.
  • Loading branch information
dweindl authored Feb 21, 2024
1 parent 3673940 commit 74d4e1f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/sdist/amici/de_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,9 @@ def _collect_heaviside_roots(
elif arg.has(sp.Heaviside):
root_funs.extend(self._collect_heaviside_roots(arg.args))

if not root_funs:
return []

# substitute 'w' expressions into root expressions now, to avoid
# rewriting 'root.cpp' and 'stau.cpp' headers
# to include 'w.h'
Expand Down

0 comments on commit 74d4e1f

Please sign in to comment.