-
-
Notifications
You must be signed in to change notification settings - Fork 17
Description
In some rare cases, an operator depends on more state than just u
, p
, and t
. For example, the W
operator in OrdinaryDiffEq
depends on dtgamma
.
If kwargs
could be propagated through update_coefficients!
, we'd be able to take advantage of the recursive infrastructure in these cases too. The call might look something like update_coefficients!(W, u, p, t; dtgamma)
: operators which do not use dtgamma
would just ignore the extra info, while an operator which would like to use it catches it and uses it. Of course, if an operator requires dtgamma
(or contains an operator that does), it could not be used as a regular SciMLOperator
for the usual use cases, but it wouldn't make sense for that to be possible in any case if the operator needs extra state.
For this to work, it seems like all that would be needed to be done is:
- Recursively propagate
kwargs
inupdate_coefficients!
forComposedOperator
's, etc. - User-provided
update_func
signatures which do not catchkwargs
should be detected and modified to catchkwargs
(and not use them), so that the usual use case ofupdate_coefficients!
still works seamlessly. (Something like https://stackoverflow.com/a/42579941?)
In general, something like this just seems like good design: while the positional args u, p, t
capture 99% of use cases, there are definitely cases (like the W
operator) which could naturally be expressed as a SciMLOperator if we just allowed an extra state dependence. Happy to take a stab at this if it's deemed a good idea.