Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit d382ad4

Browse files
committed
Fix format and add compat
1 parent 88bd472 commit d382ad4

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

Project.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ SciMLBase = "2.37.0"
6565
Setfield = "1.1.1"
6666
StaticArrays = "1.9"
6767
StaticArraysCore = "1.4.2"
68+
TaylorDiff = "0.2.5"
6869
Test = "1.10"
6970
Tracker = "0.2.33"
7071
Zygote = "0.6.69"
@@ -88,9 +89,10 @@ ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
8889
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
8990
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
9091
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
92+
TaylorDiff = "b36ab563-344f-407b-a36a-4f200bebf99c"
9193
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9294
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
9395
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
9496

9597
[targets]
96-
test = ["AllocCheck", "Aqua", "DiffEqBase", "ExplicitImports", "FiniteDiff", "ForwardDiff", "Hwloc", "InteractiveUtils", "LinearAlgebra", "NonlinearProblemLibrary", "Pkg", "PolyesterForwardDiff", "Random", "ReTestItems", "Reexport", "ReverseDiff", "StaticArrays", "Test", "Tracker", "Zygote"]
98+
test = ["AllocCheck", "Aqua", "DiffEqBase", "ExplicitImports", "FiniteDiff", "ForwardDiff", "Hwloc", "InteractiveUtils", "LinearAlgebra", "NonlinearProblemLibrary", "Pkg", "PolyesterForwardDiff", "Random", "ReTestItems", "Reexport", "ReverseDiff", "StaticArrays", "TaylorDiff", "Test", "Tracker", "Zygote"]

ext/SimpleNonlinearSolveTaylorDiffExt.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
module SimpleNonlinearSolveTaylorDiffExt
22
using SimpleNonlinearSolve
3-
using SimpleNonlinearSolve: ImmutableNonlinearProblem, ReturnCode, build_solution, check_termination, init_termination_cache
3+
using SimpleNonlinearSolve: ImmutableNonlinearProblem, ReturnCode, build_solution,
4+
check_termination, init_termination_cache
45
using SimpleNonlinearSolve: __maybe_unaliased, _get_fx, __fixed_parameter_function
56
using MaybeInplace: @bb
67
using SciMLBase: isinplace
78

89
import TaylorDiff
910

10-
@inline function __get_higher_order_derivatives(::SimpleHouseholder{N}, prob, f, x, fx) where N
11+
@inline function __get_higher_order_derivatives(
12+
::SimpleHouseholder{N}, prob, f, x, fx) where {N}
1113
vN = Val(N)
1214
l = map(one, x)
1315
t = TaylorDiff.make_seed(x, l, vN)
@@ -28,7 +30,7 @@ end
2830

2931
function SciMLBase.__solve(prob::ImmutableNonlinearProblem, alg::SimpleHouseholder{N},
3032
args...; abstol = nothing, reltol = nothing, maxiters = 1000,
31-
termination_condition = nothing, alias_u0 = false, kwargs...) where N
33+
termination_condition = nothing, alias_u0 = false, kwargs...) where {N}
3234
x = __maybe_unaliased(prob.u0, alias_u0)
3335
length(x) == 1 ||
3436
throw(ArgumentError("SimpleHouseholder only supports scalar problems"))

test/core/rootfind_tests.jl

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@testsetup module RootfindingTesting
22
using Reexport
3-
@reexport using AllocCheck, StaticArrays, Random, LinearAlgebra, ForwardDiff, DiffEqBase
3+
@reexport using AllocCheck, StaticArrays, Random, LinearAlgebra, ForwardDiff, DiffEqBase,
4+
TaylorDiff
45
import PolyesterForwardDiff
56

67
quadratic_f(u, p) = u .* u .- p
@@ -92,17 +93,17 @@ end
9293
end
9394

9495
@testitem "SimpleHouseholder" setup=[RootfindingTesting] tags=[:core] begin
95-
using TaylorDiff
9696
@testset "AutoDiff: TaylorDiff.jl" for order in (2, 3, 4)
97-
@testset "[OOP] u0: $(nameof(typeof(u0)))" for u0 in (
98-
[1.0], @SVector[1.0], 1.0)
99-
sol = benchmark_nlsolve_oop(quadratic_f, u0; solver = SimpleHouseholder{order}())
97+
@testset "[OOP] u0: $(nameof(typeof(u0)))" for u0 in ([1.0], @SVector[1.0], 1.0)
98+
sol = benchmark_nlsolve_oop(
99+
quadratic_f, u0; solver = SimpleHouseholder{order}())
100100
@test SciMLBase.successful_retcode(sol)
101101
@test all(abs.(sol.u .* sol.u .- 2) .< 1e-9)
102102
end
103103

104104
@testset "[IIP] u0: $(nameof(typeof(u0)))" for u0 in ([1.0],)
105-
sol = benchmark_nlsolve_iip(quadratic_f!, u0; solver = SimpleHouseholder{order}())
105+
sol = benchmark_nlsolve_iip(
106+
quadratic_f!, u0; solver = SimpleHouseholder{order}())
106107
@test SciMLBase.successful_retcode(sol)
107108
@test all(abs.(sol.u .* sol.u .- 2) .< 1e-9)
108109
end
@@ -112,7 +113,8 @@ end
112113
u0 in (1.0, [1.0], @SVector[1.0])
113114

114115
probN = NonlinearProblem(quadratic_f, u0, 2.0)
115-
@test all(solve(probN, SimpleHouseholder{2}(); termination_condition).u .≈ sqrt(2.0))
116+
@test all(solve(probN, SimpleHouseholder{2}(); termination_condition).u .≈
117+
sqrt(2.0))
116118
end
117119
end
118120

0 commit comments

Comments
 (0)