Skip to content

Conversation

@huanglangwen
Copy link
Contributor

No description provided.

jacobian_autodiff(f, x) = (ForwardDiff.derivative(f,x),1)
jacobian_autodiff(f, x::AbstractArray) = (ForwardDiff.jacobian(f, x),1)
jacobian_autodiff(f, x, integrator) = (ForwardDiff.derivative(f,x),1)
function jacobian_autodiff(f, x::AbstractArray, integrator)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is integrator passed as argument? It seems only integrator.f is accessed in the function body - shouldn't these calls be replaced by f, in which case integrator would be needless?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is just a legacy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how passing integrator.f instead of integrator addresses the point that I wanted to make? IMO there should be only two arguments to jacobian_autodiff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is colored jacobian.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't quite understand. My question is: why can we not replace all occurrences of odefun by f?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought f is the unwrapped function from ODEFunction object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it turns out the f is indeed the unwrapped function. I replaced odefun with f and got type UDerivativeWrapper has no field jac_prototype.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, thanks for trying! I'm wondering if it would make sense to add more traits and getproperty overloads to UDerivativeWrapper and UJacobianWrapper (as done in https://github.com/JuliaDiffEq/DiffEqBase.jl/blob/c65c0e7442b63332aac60002baa9ebb021890e76/src/diffeqfunction.jl#L883-L888) instead of passing integrator.f

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's not very friendly for extension unless there is a generic way to do it.

@coveralls
Copy link

coveralls commented Sep 22, 2019

Coverage Status

Coverage decreased (-1.2%) to 53.573% when pulling 92696c9 on huanglangwen:colorjac into 7f672a5 on JuliaDiffEq:master.

@codecov
Copy link

codecov bot commented Sep 23, 2019

Codecov Report

Merging #937 into master will increase coverage by 0.01%.
The diff coverage is 81.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #937      +/-   ##
==========================================
+ Coverage   77.18%   77.19%   +0.01%     
==========================================
  Files          97       97              
  Lines       30636    30609      -27     
==========================================
- Hits        23645    23629      -16     
+ Misses       6991     6980      -11
Impacted Files Coverage Δ
src/OrdinaryDiffEq.jl 100% <ø> (ø) ⬆️
src/derivative_wrappers.jl 83.03% <81.39%> (+8.5%) ⬆️
src/misc_utils.jl 80% <0%> (-5.72%) ⬇️
src/derivative_utils.jl 77.01% <0%> (-0.63%) ⬇️
src/alg_utils.jl 28.31% <0%> (-0.23%) ⬇️
src/perform_step/sdirk_perform_step.jl 79.14% <0%> (-0.11%) ⬇️
src/nlsolve/nlsolve.jl 94.87% <0%> (+0.42%) ⬆️
src/nlsolve/utils.jl 67.8% <0%> (+0.44%) ⬆️
src/perform_step/kencarp_kvaerno_perform_step.jl 93.01% <0%> (+0.59%) ⬆️

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 7f672a5...92696c9. Read the comment docs.

@huanglangwen
Copy link
Contributor Author

Currently , this pr fails five tests where cache tests and resize tests are related with the missing resize_jac_config! function for ForwardColorJacCache while others seems not related with this pr.

if !is_APPVEYOR && (GROUP == "All" || GROUP == "Integrators_I")
  @time @safetestset "Alg Events Tests" begin include("integrators/alg_events_tests.jl") end
  @time @safetestset "Cache Tests" begin include("integrators/ode_cache_tests.jl") end
  @time @safetestset "Add Steps Tests" begin include("integrators/ode_add_steps_tests.jl") end
end

if !is_APPVEYOR && (GROUP == "All" || GROUP == "Integrators_II")
  @time @safetestset "Reverse Directioned Event Tests" begin include("integrators/rev_events_tests.jl") end
  @time @safetestset "Resize Tests" begin include("integrators/resize_tests.jl") end
end

@huanglangwen
Copy link
Contributor Author

It seems the problems concentrate on callbacks and jaccache resize, I have no idea how to solve this. @ChrisRackauckas

@ChrisRackauckas
Copy link
Member

Alright I'm taking a look.

@huanglangwen huanglangwen mentioned this pull request Nov 12, 2019
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.

4 participants