Skip to content
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

Merged
merged 6 commits into from
Aug 5, 2018
Merged

Refactor interpolants #467

merged 6 commits into from
Aug 5, 2018

Conversation

devmotion
Copy link
Member

I tried to come up with some refactorization of the interpolants as discussed in #214 (comment):

  • I renamed the concrete implementations to _ode_interpolant and _ode_interpolant!
  • Now ode_interpolant and ode_interpolant! just call these methods, depending on the cache type and whether the desired output is nothing
  • The @def macro is used to avoid code duplications in (among others) unpacking of tableaus and computation of coefficients of the polynomials

@codecov
Copy link

codecov bot commented Aug 3, 2018

Codecov Report

Merging #467 into master will decrease coverage by 0.62%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/dense/interpolants.jl 99.42% <ø> (+1.13%) ⬆️
src/integrators/integrator_utils.jl 79.25% <ø> (-0.88%) ⬇️
src/dense/generic_dense.jl 79.14% <100%> (-1.82%) ⬇️
src/dense/rosenbrock_interpolants.jl 90.47% <100%> (+6.26%) ⬆️
src/perform_step/composite_perform_step.jl 33.33% <0%> (-66.67%) ⬇️
src/composite_algs.jl 83.33% <0%> (-16.67%) ⬇️
src/nlsolve/newton.jl 85.18% <0%> (-14.82%) ⬇️
src/exponential_utils.jl 83.33% <0%> (-13.66%) ⬇️
src/derivative_wrappers.jl 87.5% <0%> (-12.5%) ⬇️
src/alg_utils.jl 88.37% <0%> (-6.98%) ⬇️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fe2615...36bacb4. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.3%) to 93.571% when pulling 1e94210 on interpolants into fe202c8 on master.

@coveralls
Copy link

coveralls commented Aug 3, 2018

Coverage Status

Coverage increased (+5.7%) to 92.638% when pulling 36bacb4 on interpolants into 9fe2615 on master.

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
Copy link
Member

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}

Copy link
Member Author

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?

Copy link
Member

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.

@ChrisRackauckas
Copy link
Member

Smart! I like this a lot, thanks! Merge when tests pass.

@ChrisRackauckas ChrisRackauckas merged commit 896e650 into master Aug 5, 2018
@ChrisRackauckas
Copy link
Member

Thanks! This is quite a massive improvement in code quality.

@ChrisRackauckas ChrisRackauckas deleted the interpolants branch August 5, 2018 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants