-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add BatchedInterface
#65
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #65 +/- ##
===========================================
+ Coverage 0.00% 26.68% +26.68%
===========================================
Files 8 10 +2
Lines 372 476 +104
===========================================
+ Hits 0 127 +127
+ Misses 372 349 -23 ☔ View full report in Codecov by Sentry. |
@test associated_systems(bi) == [1, 1, 1, 1, 2, 2, 3, 3] | ||
|
||
getter = getu(bi) | ||
@test (@inferred getter(probs...)) == [1.0, 3.0, 0.2, 0.3, 5.0, 0.6, 0.7, 0.8] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem quite right, you'd want an array for each to make remaking easy?
src/batched_interface.jl
Outdated
if !is_variable(sys, sym) && !is_parameter(sys, sym) | ||
error("Only variables and parameters allowed in BatchedInterface.") | ||
end | ||
if !in(sym, symbol_order) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !in(sym, symbol_order) | |
if isnothing(findfirst(isequal(sym), symbol_order)) |
I think this should be changed as in
least to using symbolic variables in a Boolean context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in db5038a
59b6700
to
0e8e037
Compare
9ac7f73
to
1bfde6e
Compare
1bfde6e
to
5aad4fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
error("Only symbolic variables allowed in BatchedInterface.") | ||
end | ||
if symbolic_type(sym) === ArraySymbolic() | ||
append!(allsyms, collect(sym)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the need for ArrayPartition
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
@variables x[1:2] y z | ||
|
||
syss = [ | ||
SymbolCache([x..., y]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is splatting required? Would [x, y]
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splatting is required. SymbolCache
treats the variables as-is, so it would think x
is at index 1 and y
at 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. But for array parameters in MTK, that would be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is specifically only needed for SymbolCache
, MTK handles it completely differently. I didn't want to pull in MTK for this one test so I used Symbolics and the rest of the SII infrastructure
SciMLBase downstream failing here is my fault in MTK 😅 It's fixed in SciML/ModelingToolkit.jl#2630 |
Can we get a follow up tutorial on the batched interface? That's one that takes a bit more depth than the other pieces. |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.