Skip to content

Commit 00d7363

Browse files
committed
Fix tessts
1 parent 2edd92f commit 00d7363

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.github/workflows/Downstream.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- {user: SciML, repo: ModelingToolkit.jl, group: All}
2121
- {user: SciML, repo: OrdinaryDiffEq.jl, group: Interface}
2222
- {user: SciML, repo: OrdinaryDiffEq.jl, group: Regression}
23+
- {user: SciML, repo: BoundaryValueDiffEq.jl, group: All}
2324
steps:
2425
- uses: actions/checkout@v4
2526
- uses: julia-actions/setup-julia@v1

src/jacobian.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ __init_JᵀJ(J::StaticArray) = MArray{Tuple{size(J, 2), size(J, 2)}, eltype(J)}(
119119

120120
## Special Handling for Scalars
121121
function jacobian_caches(alg::AbstractNonlinearSolveAlgorithm, f, u::Number, p,
122-
::Val{false}; kwargs...)
122+
::Val{false}; linsolve_with_JᵀJ::Val{needsJᵀJ} = Val(false),
123+
kwargs...) where {needsJᵀJ}
123124
# NOTE: Scalar `u` assumes scalar output from `f`
124125
uf = JacobianWrapper{false}(f, p)
126+
needsJᵀJ && return uf, nothing, u, nothing, nothing, u, u, u
125127
return uf, nothing, u, nothing, nothing, u
126128
end

test/basictests.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ end
5050
end
5151

5252
precs = [
53-
NonlinearSolve.DEFAULT_PRECS,
54-
(args...) -> (Diagonal(rand!(similar(u0))), nothing),
53+
(u0) -> NonlinearSolve.DEFAULT_PRECS,
54+
u0 -> ((args...) -> (Diagonal(rand!(similar(u0))), nothing)),
5555
]
5656

5757
@testset "[IIP] u0: $(typeof(u0)) precs: $(_nameof(prec)) linsolve: $(_nameof(linsolve))" for u0 in ([
@@ -60,13 +60,13 @@ end
6060
if prec === :Random
6161
prec = (args...) -> (Diagonal(randn!(similar(u0))), nothing)
6262
end
63-
sol = benchmark_nlsolve_iip(quadratic_f!, u0; linsolve, precs = prec,
63+
sol = benchmark_nlsolve_iip(quadratic_f!, u0; linsolve, precs = prec(u0),
6464
linesearch)
6565
@test SciMLBase.successful_retcode(sol)
6666
@test all(abs.(sol.u .* sol.u .- 2) .< 1e-9)
6767

6868
cache = init(NonlinearProblem{true}(quadratic_f!, u0, 2.0),
69-
NewtonRaphson(; linsolve, precs = prec), abstol = 1e-9)
69+
NewtonRaphson(; linsolve, precs = prec(u0)), abstol = 1e-9)
7070
@test (@ballocated solve!($cache)) 64
7171
end
7272
end
@@ -91,8 +91,7 @@ end
9191
res.u res_true
9292
end
9393
@test ForwardDiff.derivative(p -> benchmark_nlsolve_oop(quadratic_f, 1.0, p).u,
94-
p)
95-
1 / (2 * sqrt(p))
94+
p) 1 / (2 * sqrt(p))
9695
end
9796
end
9897

@@ -189,8 +188,7 @@ end
189188
res.u res_true
190189
end
191190
@test ForwardDiff.derivative(p -> benchmark_nlsolve_oop(quadratic_f,
192-
oftype(p, 1.0),
193-
p; radius_update_scheme).u, p) 1 / (2 * sqrt(p))
191+
oftype(p, 1.0), p; radius_update_scheme).u, p) 1 / (2 * sqrt(p))
194192
end
195193
end
196194

0 commit comments

Comments
 (0)