-
-
Notifications
You must be signed in to change notification settings - Fork 225
fix: infer oop form for SDEProblem/SDEFunction with StaticArrays #2834
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
Conversation
b382a37
to
a73ccd8
Compare
The problem here is that this line doesn't work with static arrays. julia> [1;;] + [1]
1×1 Matrix{Int64}:
2
julia> @SArray[1;;] + @SArray[1]
ERROR: DimensionMismatch: Sizes (Size(1, 1), Size(1,)) of input arrays do not match |
That's a method only for diagonal noise, so that method won't work on array |
1x1 noise is diagonal, right? Which I guess is why I guess it hits that |
Yeah, what we should do is detect that |
72bd4fe
to
317f9c7
Compare
317f9c7
to
54df3cc
Compare
This update causes Catalyst CI to fail. Given that Catalyst has a very extensive test set, and often has catched things that the MTK tests have missed, would it make sense to not merge things which cause Catalyst downstream errors? |
(I have modified Catalyst so that it works with this new version. However, generally, I do think we should try and not ignore the CI that we got) |
I don't think the Catalyst tests are right here? |
The Catalyst tests are fine. Basically, this PR goes from requiring an internal matrix to be |
Oh I thought the Catalyst issue was the sizing thing we were talking about? Requiring Matrix{Num} isn't intentional, though it is somewhat bettter. |
No, the sizing got fixed (thanks for that!). Practically, I'm not sure of changing to |
Shouldn’t one be able to generate SDESystems without using Nums? If not, wouldn’t this require all compositional modeling tools to know to rewrap internal unwrapped expressions when generating SDESystems from other systems? |
if eqs isa AbstractMatrix && isdiag(eqs) | ||
eqs = diag(eqs) | ||
end |
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.
@ChrisRackauckas @AayushSabharwal I don't think this is correct code for symbolics. The problem is that isdiag
calls iszero
which for a non-Num will create a symbolic boolean expression, i.e.
julia> @variables A
e1-element Vector{Num}:
A
julia> eq = 5*A^2 + 2*A + 65
65 + 2A + 5(A^2)
julia> iszero(eq)
false
julia> iszero(ModelingToolkit.unwrap(eq))
(65 + 2A + 5(A^2)) == 0
So this now explicitly breaks creating an SDESystem
with unwrapped expressions.
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.
Also, as @TorkelE mentioned Catalyst master tests should now generally pass, so if Catalyst tests fail when running downstream tests on an MTK PR that is meaningful again (unlike before we updated Catalyst to MTK 9).
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.
The Catalyst v14 release hasn't been made yet, so it's still not testing the updated code?
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.
The problem is that isdiag calls iszero which for a non-Num will create a symbolic boolean expression, i.e.
Thanks, we need to have a different isdiag
that uses isequal
. @AayushSabharwal can you prioritize this?
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.
@isaacsas is there an issue open on this? If so, let's assign @AayushSabharwal to it.
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.
I opened #2868
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.
The Catalyst v14 release hasn't been made yet, so it's still not testing the updated code?
Also, doesn't this:
https://github.com/SciML/ModelingToolkit.jl/actions/runs/9772401615/job/26976712250#step:6:579
indicate it was tested against Catalyst master?
Close #2814
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.