Skip to content

Commit

Permalink
Use a default NonlinearSolve Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 27, 2023
1 parent d8d1c95 commit 8de2b6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,17 @@ function get_concrete_algorithm(alg, prob)
return __get_concrete_algorithm(alg, prob)
end

struct NonlinearSolveTag end

function __get_concrete_algorithm(alg, prob)
@unpack sparsity, jac_prototype = prob.f
use_sparse_ad = sparsity !== nothing || jac_prototype !== nothing
ad = if eltype(prob.u0) <: Complex
# Use Finite Differencing
use_sparse_ad ? AutoSparseFiniteDiff() : AutoFiniteDiff()
else
use_sparse_ad ? AutoSparseForwardDiff() : AutoForwardDiff{nothing, Nothing}(nothing)
tag = NonlinearSolveTag()
use_sparse_ad ? AutoSparseForwardDiff(; tag) : AutoForwardDiff(; tag)
end
return set_ad(alg, ad)
end
Expand Down

0 comments on commit 8de2b6f

Please sign in to comment.