-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Refactor interpolants #467
Conversation
Codecov Report
@@ Coverage Diff @@
## master #467 +/- ##
=========================================
- Coverage 95.12% 94.5% -0.63%
=========================================
Files 80 80
Lines 8868 8648 -220
=========================================
- Hits 8436 8173 -263
- Misses 432 475 +43
Continue to review full report at Codecov.
|
1e94210
to
f2823e3
Compare
src/dense/generic_dense.jl
Outdated
function ode_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T::Type{Val{TI}}) where TI | ||
_ode_interpolant(Θ,dt,y₀,y₁,k,cache,idxs,T) | ||
end | ||
|
||
function ode_interpolant(Θ,dt,y₀,y₁,k,cache::OrdinaryDiffEqMutableCache,idxs,T::Type{Val{TI}}) where TI | ||
if typeof(idxs) <: Number || typeof(y₀) <: Number |
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 this should have typeof(y₀) <: Union{Number,SArray}
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 is just copied, nothing new here. Can it actually happen that this is called with static vectors and a mutable cache?
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.
Oh I missed the mutable cache part. I don't think it's possible. I'm pretty sure any method would error, so I guess just if typeof(idxs) <: Number
is all that's necessary.
Smart! I like this a lot, thanks! Merge when tests pass. |
Thanks! This is quite a massive improvement in code quality. |
I tried to come up with some refactorization of the interpolants as discussed in #214 (comment):
_ode_interpolant
and_ode_interpolant!
ode_interpolant
andode_interpolant!
just call these methods, depending on the cache type and whether the desired output isnothing
@def
macro is used to avoid code duplications in (among others) unpacking of tableaus and computation of coefficients of the polynomials