SciML / Catalyst.jl

Chemical reaction network and systems biology interface for scientific machine learning (SciML). High performance, GPU-parallelized, and O(1) solvers in open source software.
https://docs.sciml.ai/Catalyst/stable/
Other
460 stars 77 forks source link

[v14 - Ready] Fix bug where `expand_registered_functions` mutated original reaction system #929

Closed TorkelE closed 3 months ago

TorkelE commented 3 months ago

Previously expand_registered_functions would unintentionally apply the operation on the input system. E.g.

rs_expanded_funcs = Catalyst.expand_registered_functions(rs)

would result in both rs and rs_expanded_funcs having their functions expanded. This fixes this, and adds a test to ensure this remains the case.

TorkelE commented 3 months ago

Sorry, totally forgot about this one. I think I will add the checks, it should be fairly straightforward with the new symbolic functions.

TorkelE commented 3 months ago

Ok, I have changed around the internals (no longer using deepcopy, although Symbolics might use something similar internally, I am not sure) and also supporting events.