Add new interface for symbolic indexing - #236
Merged
Merged
Conversation
- DiffEqArray now stores the new `SymbolCache` struct, which defines and implements its interface to query symbols - DiffEqArray supports symbolically indexing parameters, if provided
Member
Author
|
This gets a little annoying due to the compatibility with the old route: ends up constructing a |
- SymbolCache and interface functions added and exported - `states`, `parameters` and `independent_variables` hoisted down from MTK
- DiffEqArray constructs SymbolCache taking into account if `indepsym` is `nothing`, a single symbol or an `AbstractArray` of symbols - Test symbolic indexing functionality
- `symbolic_indexing_interface.jl` moved to its own package - Update tests accordingly
AayushSabharwal
marked this pull request as ready for review
December 12, 2022 07:53
Member
Author
|
There is one major downside here: to avoid breaking changes, the constructors for DiffEqArray have been modified to work the same way they did before. However, this makes it so that trying to construct a DiffEqArray with a system requires specifying type parameters: DiffEqArray(u, t, syms, indepsym, observed, p) # works as it did before
DiffEqArray(u, t, sys, observed, p) # interprets sys as syms, observed as indepsym and p and observed
DiffEqArray{..., typeof(sys), typeof(observed), typeof(p)}(u, t, sys, observed, p) # worksAlso, to specify paramsyms (without a system) sc = SymbolCache(syms, indepsym, paramsyms)
DiffEqArray{..., typeof(sc), typeof(observed), typeof(p)}(u, t, sc, observed, p) |
Member
|
That's a fine wart for now. Open an issue to deprecate that in the next breaking update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SymbolCachestruct, which defines and implements its interface to query symbolsSee SciML/ModelingToolkit.jl#1988
All tests pass as-is (except GPU, which I haven't been able to run locally), so this shouldn't be breaking. The constructors are modified to have the same interface but create the new structures