Skip to content

Commit 0c9d358

Browse files
committed
Fix the AD tests
1 parent 6084a88 commit 0c9d358

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ext/NonlinearSolveNLsolveExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::NLsolveJL, args...;
1717
if prob.u0 isa Number
1818
resid = [NonlinearSolve.evaluate_f(prob, first(u0))]
1919
else
20-
resid = NonlinearSolve.evaluate_f(prob, u0)
20+
resid = NonlinearSolve.evaluate_f(prob, prob.u0)
2121
end
2222

2323
jac! = NonlinearSolve.__construct_jac(prob, alg, u0)

test/core/forward_ad.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,21 @@ __compatible(::Number, ::AbstractArray) = false
4242
__compatible(u::AbstractArray, p::AbstractArray) = size(u) == size(p)
4343

4444
__compatible(u::Number, ::SciMLBase.AbstractNonlinearAlgorithm) = true
45-
__compatible(u::Number, ::Union{CMINPACK, NLsolveJL}) = true
45+
__compatible(u::Number, ::Union{CMINPACK, NLsolveJL, KINSOL}) = true
4646
__compatible(u::AbstractArray, ::SciMLBase.AbstractNonlinearAlgorithm) = true
47+
__compatible(u::AbstractArray{T, N}, ::KINSOL) where {T, N} = N == 1 # Need to be fixed upstream
48+
__compatible(u::StaticArray{S, T, N}, ::KINSOL) where {S <: Tuple, T, N} = false
4749
__compatible(u::StaticArray, ::SciMLBase.AbstractNonlinearAlgorithm) = true
48-
__compatible(u::StaticArray, ::Union{CMINPACK, NLsolveJL}) = false
50+
__compatible(u::StaticArray, ::Union{CMINPACK, NLsolveJL, KINSOL}) = false
4951
__compatible(u, ::Nothing) = true
5052

5153
__compatible(::Any, ::Any) = true
5254
__compatible(::CMINPACK, ::Val{:iip_cache}) = false
5355
__compatible(::CMINPACK, ::Val{:oop_cache}) = false
5456
__compatible(::NLsolveJL, ::Val{:iip_cache}) = false
5557
__compatible(::NLsolveJL, ::Val{:oop_cache}) = false
58+
__compatible(::KINSOL, ::Val{:iip_cache}) = false
59+
__compatible(::KINSOL, ::Val{:oop_cache}) = false
5660

5761
@testset "ForwardDiff.jl Integration: $(alg)" for alg in (NewtonRaphson(), TrustRegion(),
5862
LevenbergMarquardt(), PseudoTransient(; alpha_initial = 10.0), Broyden(), Klement(),

0 commit comments

Comments
 (0)