Skip to content

Commit bb62c6c

Browse files
committed
Default to polyester forward diff
1 parent 1c427a6 commit bb62c6c

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

Project.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NonlinearSolve"
22
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
33
authors = ["SciML"]
4-
version = "3.5.0"
4+
version = "3.6.0"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -36,6 +36,7 @@ FixedPointAcceleration = "817d07cb-a79a-5c30-9a31-890123675176"
3636
LeastSquaresOptim = "0fc2ff8b-aaa3-5acd-a817-1944a5e08891"
3737
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
3838
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
39+
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
3940
SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4"
4041
SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412"
4142
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
@@ -48,6 +49,7 @@ NonlinearSolveFixedPointAccelerationExt = "FixedPointAcceleration"
4849
NonlinearSolveLeastSquaresOptimExt = "LeastSquaresOptim"
4950
NonlinearSolveMINPACKExt = "MINPACK"
5051
NonlinearSolveNLsolveExt = "NLsolve"
52+
NonlinearSolvePolyesterForwardDiffExt = "PolyesterForwardDiff"
5153
NonlinearSolveSIAMFANLEquationsExt = "SIAMFANLEquations"
5254
NonlinearSolveSpeedMappingExt = "SpeedMapping"
5355
NonlinearSolveSymbolicsExt = "Symbolics"
@@ -83,6 +85,7 @@ Pkg = "1.10"
8385
PrecompileTools = "1.2"
8486
Preferences = "1.4"
8587
Printf = "1.10"
88+
PolyesterForwardDiff = "0.1.1"
8689
Random = "1.91"
8790
RecursiveArrayTools = "3.4"
8891
Reexport = "1.2"
@@ -91,7 +94,7 @@ SafeTestsets = "0.1"
9194
SciMLBase = "2.19.0"
9295
SimpleNonlinearSolve = "1.2"
9396
SparseArrays = "1.10"
94-
SparseDiffTools = "2.14"
97+
SparseDiffTools = "2.16"
9598
SpeedMapping = "0.3"
9699
StableRNGs = "1"
97100
StaticArrays = "1.7"
@@ -121,6 +124,7 @@ NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
121124
NonlinearProblemLibrary = "b7050fa9-e91f-4b37-bcee-a89a063da141"
122125
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
123126
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
127+
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
124128
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
125129
SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4"
126130
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
@@ -134,4 +138,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
134138
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
135139

136140
[targets]
137-
test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials"]
141+
test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials", "PolyesterForwardDiff"]

docs/src/tutorials/large_systems.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The resulting `NonlinearProblem` definition is:
6161

6262
```@example ill_conditioned_nlprob
6363
using NonlinearSolve, LinearAlgebra, SparseArrays, LinearSolve, SparseDiffTools
64+
import PolyesterForwardDiff
6465
6566
const N = 32
6667
const xyd_brusselator = range(0, stop = 1, length = N)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module NonlinearSolvePolyesterForwardDiffExt
2+
3+
using NonlinearSolve, PolyesterForwardDiff
4+
5+
NonlinearSolve.is_extension_loaded(::Val{:PolyesterForwardDiff}) = true
6+
7+
end

src/internal/helpers.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ function get_concrete_forward_ad(autodiff, prob, sp::Val{test_sparse} = True, ar
6363
use_sparse_ad ? AutoSparseFiniteDiff() : AutoFiniteDiff()
6464
else
6565
tag = ForwardDiff.Tag(NonlinearSolveTag(), eltype(prob.u0))
66-
(use_sparse_ad ? AutoSparseForwardDiff : AutoForwardDiff)(; tag)
66+
if use_sparse_ad
67+
AutoSparseForwardDiff(; tag) # Polyester Sparse Mode is not implemented yet
68+
elseif is_extension_loaded(Val(:PolyesterForwardDiff)) &&
69+
!(prob.u0 isa Number || prob.u0 isa SArray)
70+
AutoPolyesterForwardDiff()
71+
else
72+
AutoForwardDiff(; tag)
73+
end
6774
end
6875
return ad
6976
end

0 commit comments

Comments
 (0)