Skip to content

Commit

Permalink
simplify jac_config
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Sep 12, 2024
1 parent 35a47fb commit a22c77d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,11 @@ function jacobian!(J::AbstractMatrix{<:Number}, f, x::AbstractArray{<:Number},
nothing
end

function build_jac_config(alg, f::F1, uf::F2, du1, uprev, u, tmp, du2,
::Val{transform} = Val(true)) where {transform, F1, F2}
function build_jac_config(alg, f::F1, uf::F2, du1, uprev, u, tmp, du2) where {F1, F2}
haslinsolve = hasfield(typeof(alg), :linsolve)

if !DiffEqBase.has_jac(f) && # No Jacobian if has analytical solution
(transform || !DiffEqBase.has_Wfact(f)) && # No Jacobian if has_Wfact and Wfact is the one that's used
(!transform || !DiffEqBase.has_Wfact_t(f)) && # No Jacobian has_Wfact and Wfact_t is the one that's used
(!DiffEqBase.has_Wfact_t(f)) &&
((concrete_jac(alg) === nothing && (!haslinsolve || (haslinsolve && # No Jacobian if linsolve doesn't want it
(alg.linsolve === nothing || LinearSolve.needs_concrete_A(alg.linsolve))))) ||
(concrete_jac(alg) !== nothing && concrete_jac(alg))) # Jacobian if explicitly asked for
Expand Down

0 comments on commit a22c77d

Please sign in to comment.