@@ -20,21 +20,28 @@ function benchmark_scalar(f, u0)
2020 sol = (solve (probN, NewtonRaphson ()))
2121end
2222
23- f, u0 = (u,p) -> u .* u .- 2 , @SVector [1.0 , 1.0 ]
24- sf, su0 = (u,p) -> u * u - 2 , 1.0
25- sol = benchmark_immutable (f, u0)
23+ function ff (u,p)
24+ u .* u .- 2
25+ end
26+ const cu0 = @SVector [1.0 , 1.0 ]
27+ function sf (u,p)
28+ u * u - 2
29+ end
30+ const csu0 = 1.0
31+
32+ sol = benchmark_immutable (ff, cu0)
2633@test sol. retcode === Symbol (NonlinearSolve. DEFAULT)
2734@test all (sol. u .* sol. u .- 2 .< 1e-9 )
28- sol = benchmark_mutable (f, u0 )
35+ sol = benchmark_mutable (ff, cu0 )
2936@test sol. retcode === Symbol (NonlinearSolve. DEFAULT)
3037@test all (sol. u .* sol. u .- 2 .< 1e-9 )
31- sol = benchmark_scalar (sf, su0 )
38+ sol = benchmark_scalar (sf, csu0 )
3239@test sol. retcode === Symbol (NonlinearSolve. DEFAULT)
3340@test sol. u * sol. u - 2 < 1e-9
3441
35- @test (@ballocated benchmark_immutable ($ f, $ u0 )) == 0
36- @test (@ballocated benchmark_mutable ($ f, $ u0 )) < 200
37- @test (@ballocated benchmark_scalar ($ sf, $ su0 )) == 0
42+ @test (@ballocated benchmark_immutable (ff, cu0 )) == 0
43+ @test (@ballocated benchmark_mutable (ff, cu0 )) < 200
44+ @test (@ballocated benchmark_scalar (sf, csu0 )) == 0
3845
3946# AD Tests
4047using ForwardDiff
@@ -143,7 +150,7 @@ sol = solve!(solver)
143150# these should call the iterator version
144151solver = init (probB, Bisection ())
145152@test solver isa NonlinearSolve. BracketingImmutableSolver
146- # Question: Do we need BracketingImmutableSolver? We have fast scalar overload and
153+ # Question: Do we need BracketingImmutableSolver? We have fast scalar overload and
147154# Bracketing solvers work only for scalars.
148155
149156solver = init (probB, Bisection (); immutable = false )
0 commit comments