-
-
Notifications
You must be signed in to change notification settings - Fork 235
add J, W cache and linsolve interface for rosenbrock oop methods and add J cache for firk oop #873
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
|
I think we should not introduce an additional implementation for generating |
Codecov Report
@@ Coverage Diff @@
## master #873 +/- ##
==========================================
+ Coverage 80.16% 80.35% +0.18%
==========================================
Files 92 92
Lines 30269 30244 -25
==========================================
+ Hits 24265 24302 +37
+ Misses 6004 5942 -62
Continue to review full report at Codecov.
|
|
It seems the oopgenW is broken when |
|
I guess it's the first time that someone actually tests the whole logic of J = if ndims(u) == 2 # `u` is already a matrix
u
else # `u` is a vector
hcat(u, u)
endCan you check if that solves the issue? To be honest, it still feels very crude to me, the units are incorrect and will fail if the dimension of |
|
Aren't we already vecing |
I don't see how this is related to the test failure? But I agree that probably we should just replace the snippet above and https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/cd45039e49eefdc5d60aa72b54f91e84851eb747/src/integrators/integrator_utils.jl#L438 with J = false .* _vec(u) .* _vec(u)'That would be much cleaner. Then we could just branch depending on the type of |
|
The real difficulty is that we don't have an OOP linsolve interface, which we need to get in order to really complete this I think? |
|
And the fact that |
Your patch works anyway. Shall I push that? |
Actually, it seems J = false .* _vec(u) .* _vec(u)'
W = if u isa StaticArray
lu(J)
elseif u isa Number
u
else
LU{LinearAlgebra.lutype(uEltypeNoUnits)}(Matrix{uEltypeNoUnits}(undef, 0, 0),
Vector{LinearAlgebra.BlasInt}(undef, 0),
zero(LinearAlgebra.BlasInt))
end |
What's the motivation to move from |
|
|
Never mind. We want to use factorization methods other than |
Co-Authored-By: Yingbo Ma <[email protected]>
src/caches/rosenbrock_caches.jl
Outdated
| tmp = zero(rate_prototype) | ||
| atmp = similar(u, uEltypeNoUnits) | ||
| tab = Rosenbrock23ConstantCache(real(uBottomEltypeNoUnits),identity,identity) | ||
| tab = Rosenbrock23ConstantCache(real(uBottomEltypeNoUnits),identity,identity,nothing,nothing,nothing) |
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 always thought that we shouldn't misuse the oop cache as tableau but rather use separate tableau structs - and even more so with the new fields for J and W.
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.
yeah, it's really just a short hand that always worked... until it didn't.
|
Is this pr good for merge? I want to start a new pr for unifying oop and iip in |
src/caches/rosenbrock_caches.jl
Outdated
| tmp = zero(rate_prototype) | ||
| atmp = similar(u, uEltypeNoUnits) | ||
| tab = Rosenbrock23ConstantCache(real(uBottomEltypeNoUnits),identity,identity,nothing,nothing,nothing) | ||
| tab = Ros23ConstantCache(real(uBottomEltypeNoUnits)) |
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 think I would prefer the name Rosenbrock23Tableau or something similar, Ros23ConstantCache seems a bit strange to me.
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 agree, but then we need to correct all the tab struct in \tableaus as well as places calling the tabs in \caches
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.
Sure, there might be some other structs which probably should be renamed as well but that can be done in a different PR, I guess. For now, IMO it's sufficient to name the new struct in a reasonable way 😃
src/caches/rosenbrock_caches.jl
Outdated
| tmp = zero(rate_prototype) | ||
| atmp = similar(u, uEltypeNoUnits) | ||
| tab = Rosenbrock32ConstantCache(real(uBottomEltypeNoUnits),identity,identity,nothing,nothing,nothing) | ||
| tab = Ros32ConstantCache(real(uBottomEltypeNoUnits)) |
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.
Similar to my comment above, I think we should use something a bit more meaningful than Ros32ConstantCache.
|
Let's continue the renames as another PR. Also note that in the sphere of influence for this should be @saurabhkgp21's newest implicit extrapolation methods. For those methods, we need a safe-hatch so that way Jacobian reuse is just generally turned off. In other cases, having an easy switch on it is nice anyways, so it's something to keep in mind. |
#871