diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml deleted file mode 100644 index 959ad88..0000000 --- a/.JuliaFormatter.toml +++ /dev/null @@ -1,3 +0,0 @@ -style = "sciml" -format_markdown = true -format_docstrings = true \ No newline at end of file diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml new file mode 100644 index 0000000..6762c6f --- /dev/null +++ b/.github/workflows/FormatCheck.yml @@ -0,0 +1,19 @@ +name: format-check + +on: + push: + branches: + - 'master' + - 'main' + - 'release-' + tags: '*' + pull_request: + +jobs: + runic: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: fredrikekre/runic-action@v1 + with: + version: '1' diff --git a/ext/ADTypesChainRulesCoreExt.jl b/ext/ADTypesChainRulesCoreExt.jl index 4ce76b6..7622742 100644 --- a/ext/ADTypesChainRulesCoreExt.jl +++ b/ext/ADTypesChainRulesCoreExt.jl @@ -2,26 +2,26 @@ module ADTypesChainRulesCoreExt using ADTypes: ADTypes, AutoChainRules using ChainRulesCore: HasForwardsMode, HasReverseMode, - NoForwardsMode, NoReverseMode, - RuleConfig + NoForwardsMode, NoReverseMode, + RuleConfig # see https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html function ADTypes.mode(::AutoChainRules{RC}) where { - RC <: RuleConfig{>:HasForwardsMode} -} + RC <: RuleConfig{>:HasForwardsMode}, + } return ADTypes.ForwardMode() end function ADTypes.mode(::AutoChainRules{RC}) where { - RC <: RuleConfig{>:HasReverseMode} -} + RC <: RuleConfig{>:HasReverseMode}, + } return ADTypes.ReverseMode() end function ADTypes.mode(::AutoChainRules{RC}) where { - RC <: RuleConfig{>:Union{HasForwardsMode, HasReverseMode}} -} + RC <: RuleConfig{>:Union{HasForwardsMode, HasReverseMode}}, + } # more specific than the previous two return ADTypes.ForwardOrReverseMode() end diff --git a/src/ADTypes.jl b/src/ADTypes.jl index 609087e..f53cee1 100644 --- a/src/ADTypes.jl +++ b/src/ADTypes.jl @@ -29,26 +29,26 @@ include("symbols.jl") # Automatic Differentiation export AbstractADType export AutoChainRules, - AutoDiffractor, - AutoEnzyme, - AutoFastDifferentiation, - AutoFiniteDiff, - AutoFiniteDifferences, - AutoForwardDiff, - AutoGTPSA, - AutoModelingToolkit, - AutoMooncake, - AutoMooncakeForward, - AutoPolyesterForwardDiff, - AutoReverseDiff, - AutoSymbolics, - AutoTapir, - AutoTaylorDiff, - AutoTracker, - AutoZygote, - NoAutoDiff, - NoAutoDiffSelectedError, - AutoReactant + AutoDiffractor, + AutoEnzyme, + AutoFastDifferentiation, + AutoFiniteDiff, + AutoFiniteDifferences, + AutoForwardDiff, + AutoGTPSA, + AutoModelingToolkit, + AutoMooncake, + AutoMooncakeForward, + AutoPolyesterForwardDiff, + AutoReverseDiff, + AutoSymbolics, + AutoTapir, + AutoTaylorDiff, + AutoTracker, + AutoZygote, + NoAutoDiff, + NoAutoDiffSelectedError, + AutoReactant @public AbstractMode @public ForwardMode, ReverseMode, ForwardOrReverseMode, SymbolicMode @public mode diff --git a/src/compat.jl b/src/compat.jl index d9d02c1..472ee09 100644 --- a/src/compat.jl +++ b/src/compat.jl @@ -1,9 +1,9 @@ -# Backward compatibility with `public` keyword, as suggested in +# Backward compatibility with `public` keyword, as suggested in # https://discourse.julialang.org/t/is-compat-jl-worth-it-for-the-public-keyword/119041/22 macro public(ex) - if VERSION >= v"1.11.0-DEV.469" + return if VERSION >= v"1.11.0-DEV.469" args = ex isa Symbol ? (ex,) : - Base.isexpr(ex, :tuple) ? ex.args : error("Failed to mark $ex as public") + Base.isexpr(ex, :tuple) ? ex.args : error("Failed to mark $ex as public") esc(Expr(:public, args...)) else nothing diff --git a/src/dense.jl b/src/dense.jl index c75ceb9..6f7944d 100644 --- a/src/dense.jl +++ b/src/dense.jl @@ -20,7 +20,7 @@ end mode(::AutoChainRules) = ForwardOrReverseMode() # specialized in the extension function Base.show(io::IO, backend::AutoChainRules) - print(io, AutoChainRules, "(ruleconfig=", repr(backend.ruleconfig; context = io), ")") + return print(io, AutoChainRules, "(ruleconfig=", repr(backend.ruleconfig; context = io), ")") end """ @@ -68,7 +68,8 @@ struct AutoEnzyme{M, A} <: AbstractADType end function AutoEnzyme(; - mode::M = nothing, function_annotation::Type{A} = Nothing) where {M, A} + mode::M = nothing, function_annotation::Type{A} = Nothing + ) where {M, A} return AutoEnzyme{M, A}(mode) end @@ -79,7 +80,7 @@ function Base.show(io::IO, backend::AutoEnzyme{M, A}) where {M, A} !isnothing(backend.mode) && print(io, "mode=", repr(backend.mode; context = io)) !isnothing(backend.mode) && !(A <: Nothing) && print(io, ", ") !(A <: Nothing) && print(io, "function_annotation=", repr(A; context = io)) - print(io, ")") + return print(io, ")") end @@ -101,12 +102,13 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl). + an [`AutoEnzyme`](@ref) object if a specific mode is required + `nothing` to choose the best mode automatically """ -struct AutoReactant{M<:AutoEnzyme} <: AbstractADType +struct AutoReactant{M <: AutoEnzyme} <: AbstractADType mode::M end function AutoReactant(; - mode::Union{AutoEnzyme,Nothing} = nothing) + mode::Union{AutoEnzyme, Nothing} = nothing + ) if mode === nothing mode = AutoEnzyme() end @@ -118,7 +120,7 @@ mode(r::AutoReactant) = mode(r.mode) function Base.show(io::IO, backend::AutoReactant) print(io, AutoReactant, "(") print(io, "mode=", repr(backend.mode; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -184,7 +186,7 @@ function Base.show(io::IO, backend::AutoFiniteDiff) print(io, "absstep=", repr(backend.absstep; context = io), ", ") backend.dir != true && print(io, "dir=", repr(backend.dir; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -209,7 +211,7 @@ end mode(::AutoFiniteDifferences) = ForwardMode() function Base.show(io::IO, backend::AutoFiniteDifferences) - print(io, AutoFiniteDifferences, "(fdm=", repr(backend.fdm; context = io), ")") + return print(io, AutoFiniteDifferences, "(fdm=", repr(backend.fdm; context = io), ")") end """ @@ -245,10 +247,12 @@ mode(::AutoForwardDiff) = ForwardMode() function Base.show(io::IO, backend::AutoForwardDiff{chunksize}) where {chunksize} print(io, AutoForwardDiff, "(") - chunksize !== nothing && print(io, "chunksize=", repr(chunksize; context = io), - (backend.tag !== nothing ? ", " : "")) + chunksize !== nothing && print( + io, "chunksize=", repr(chunksize; context = io), + (backend.tag !== nothing ? ", " : "") + ) backend.tag !== nothing && print(io, "tag=", repr(backend.tag; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -277,7 +281,7 @@ mode(::AutoTaylorDiff) = ForwardMode() function Base.show(io::IO, ::AutoTaylorDiff{order}) where {order} print(io, AutoTaylorDiff, "(") print(io, "order=", repr(order; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -309,7 +313,7 @@ mode(::AutoGTPSA) = ForwardMode() function Base.show(io::IO, backend::AutoGTPSA{D}) where {D} print(io, AutoGTPSA, "(") D != Nothing && print(io, "descriptor=", repr(backend.descriptor; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -343,7 +347,7 @@ function Base.show(io::IO, backend::AutoMooncake) print(io, AutoMooncake, "(") backend.config !== nothing && print(io, "config=", repr(backend.config; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -377,7 +381,7 @@ function Base.show(io::IO, backend::AutoMooncakeForward) print(io, AutoMooncakeForward, "(") backend.config !== nothing && print(io, "config=", repr(backend.config; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -415,10 +419,12 @@ mode(::AutoPolyesterForwardDiff) = ForwardMode() function Base.show(io::IO, backend::AutoPolyesterForwardDiff{chunksize}) where {chunksize} print(io, AutoPolyesterForwardDiff, "(") - chunksize !== nothing && print(io, "chunksize=", repr(chunksize; context = io), - (backend.tag !== nothing ? ", " : "")) + chunksize !== nothing && print( + io, "chunksize=", repr(chunksize; context = io), + (backend.tag !== nothing ? ", " : "") + ) backend.tag !== nothing && print(io, "tag=", repr(backend.tag; context = io)) - print(io, ")") + return print(io, ")") end """ @@ -466,7 +472,8 @@ function Base.getproperty(ad::AutoReverseDiff, s::Symbol) if s === :compile Base.depwarn( "`ad.compile` where `ad` is `AutoReverseDiff` has been deprecated and will be removed in v2. Instead it is available as a compile-time constant as `AutoReverseDiff{true}` or `AutoReverseDiff{false}`.", - :getproperty) + :getproperty + ) end return getfield(ad, s) end @@ -476,7 +483,7 @@ mode(::AutoReverseDiff) = ReverseMode() function Base.show(io::IO, ::AutoReverseDiff{compile}) where {compile} print(io, AutoReverseDiff, "(") compile && print(io, "compile=true") - print(io, ")") + return print(io, ")") end """ @@ -522,7 +529,7 @@ mode(::AutoTapir) = ReverseMode() function Base.show(io::IO, backend::AutoTapir) print(io, AutoTapir, "(") !(backend.safe_mode) && print(io, "safe_mode=false") - print(io, ")") + return print(io, ")") end """ diff --git a/src/legacy.jl b/src/legacy.jl index 9cda0f4..b83bc8b 100644 --- a/src/legacy.jl +++ b/src/legacy.jl @@ -4,8 +4,11 @@ @deprecate AutoSparseForwardDiff(; kwargs...) AutoSparse(AutoForwardDiff(; kwargs...)) -@deprecate AutoSparsePolyesterForwardDiff(; kwargs...) AutoSparse(AutoPolyesterForwardDiff(; - kwargs...)) +@deprecate AutoSparsePolyesterForwardDiff(; kwargs...) AutoSparse( + AutoPolyesterForwardDiff(; + kwargs... + ) +) @deprecate AutoSparseReverseDiff(; kwargs...) AutoSparse(AutoReverseDiff(; kwargs...)) @@ -26,14 +29,16 @@ end function AutoModelingToolkit(obj_sparse::Bool, cons_sparse::Bool) Base.depwarn( "`AutoModelingToolkit(obj_sparse, cons_sparse)` is deprecated, use `AutoSymbolics()` or `AutoSparse(AutoSymbolics())` instead.", - :AutoModelingToolkit; force = false) + :AutoModelingToolkit; force = false + ) return mtk_to_symbolics(obj_sparse, cons_sparse) end function AutoModelingToolkit(; obj_sparse::Bool = false, cons_sparse::Bool = false) Base.depwarn( "`AutoModelingToolkit(; obj_sparse, cons_sparse)` is deprecated, use `AutoSymbolics()` or `AutoSparse(AutoSymbolics())` instead.", - :AutoModelingToolkit; force = false) + :AutoModelingToolkit; force = false + ) return mtk_to_symbolics(obj_sparse, cons_sparse) end diff --git a/src/sparse.jl b/src/sparse.jl index 21dd8c6..1d1e7c5 100644 --- a/src/sparse.jl +++ b/src/sparse.jl @@ -191,10 +191,10 @@ Wraps an ADTypes.jl object to deal with sparse Jacobians and Hessians. ) """ struct AutoSparse{ - D <: AbstractADType, - S <: AbstractSparsityDetector, - C <: AbstractColoringAlgorithm -} <: AbstractADType + D <: AbstractADType, + S <: AbstractSparsityDetector, + C <: AbstractColoringAlgorithm, + } <: AbstractADType dense_ad::D sparsity_detector::S coloring_algorithm::C @@ -203,11 +203,12 @@ end function AutoSparse( dense_ad; sparsity_detector = NoSparsityDetector(), - coloring_algorithm = NoColoringAlgorithm()) + coloring_algorithm = NoColoringAlgorithm() + ) return AutoSparse{ typeof(dense_ad), typeof(sparsity_detector), - typeof(coloring_algorithm) + typeof(coloring_algorithm), }(dense_ad, sparsity_detector, coloring_algorithm) end @@ -218,9 +219,10 @@ function Base.show(io::IO, backend::AutoSparse) end if backend.coloring_algorithm != NoColoringAlgorithm() print( - io, ", coloring_algorithm=", repr(backend.coloring_algorithm, context = io)) + io, ", coloring_algorithm=", repr(backend.coloring_algorithm, context = io) + ) end - print(io, ")") + return print(io, ")") end """ diff --git a/src/symbols.jl b/src/symbols.jl index eba4d86..11d27ca 100644 --- a/src/symbols.jl +++ b/src/symbols.jl @@ -22,11 +22,14 @@ ADTypes.AutoZygote() """ Auto(package::Symbol, args...; kws...) = Auto(Val(package), args...; kws...) -for backend in (:ChainRules, :Diffractor, :Enzyme, :Reactant, :FastDifferentiation, - :FiniteDiff, :FiniteDifferences, :ForwardDiff, :GTPSA, :Mooncake, :PolyesterForwardDiff, - :ReverseDiff, :Symbolics, :Tapir, :TaylorDiff, :Tracker, :Zygote) +for backend in ( + :ChainRules, :Diffractor, :Enzyme, :Reactant, :FastDifferentiation, + :FiniteDiff, :FiniteDifferences, :ForwardDiff, :GTPSA, :Mooncake, :PolyesterForwardDiff, + :ReverseDiff, :Symbolics, :Tapir, :TaylorDiff, :Tracker, :Zygote, + ) @eval Auto(::Val{$(QuoteNode(backend))}, args...; kws...) = $(Symbol(:Auto, backend))( - args...; kws...) + args...; kws... + ) end Auto(::Nothing) = NoAutoDiff() diff --git a/test/dense.jl b/test/dense.jl index 2eee7e1..932b8ef 100644 --- a/test/dense.jl +++ b/test/dense.jl @@ -45,7 +45,8 @@ end @test ad.mode === nothing ad = AutoEnzyme(; - mode = EnzymeCore.Reverse, function_annotation = EnzymeCore.Duplicated) + mode = EnzymeCore.Reverse, function_annotation = EnzymeCore.Duplicated + ) @test ad isa AbstractADType @test ad isa AutoEnzyme{typeof(EnzymeCore.Reverse), EnzymeCore.Duplicated} @test mode(ad) isa ReverseMode @@ -60,20 +61,23 @@ end @test ad.mode.mode === nothing @test mode(ad) isa ForwardOrReverseMode - ad = AutoReactant(; mode=AutoEnzyme(; mode = EnzymeCore.Forward)) + ad = AutoReactant(; mode = AutoEnzyme(; mode = EnzymeCore.Forward)) @test ad isa AbstractADType @test ad isa AutoReactant{<:AutoEnzyme{typeof(EnzymeCore.Forward), Nothing}} @test mode(ad) isa ForwardMode @test ad.mode.mode == EnzymeCore.Forward - ad = AutoReactant(; mode=AutoEnzyme(; function_annotation = EnzymeCore.Const)) + ad = AutoReactant(; mode = AutoEnzyme(; function_annotation = EnzymeCore.Const)) @test ad isa AbstractADType @test ad isa AutoReactant{<:AutoEnzyme{Nothing, EnzymeCore.Const}} @test mode(ad) isa ForwardOrReverseMode @test ad.mode.mode === nothing - ad = AutoReactant(; mode=AutoEnzyme(; - mode = EnzymeCore.Reverse, function_annotation = EnzymeCore.Duplicated)) + ad = AutoReactant(; + mode = AutoEnzyme(; + mode = EnzymeCore.Reverse, function_annotation = EnzymeCore.Duplicated + ) + ) @test ad isa AbstractADType @test ad isa AutoReactant{<:AutoEnzyme{typeof(EnzymeCore.Reverse), EnzymeCore.Duplicated}} @test mode(ad) isa ReverseMode @@ -99,16 +103,18 @@ end @test ad.absstep === nothing @test ad.dir - ad = AutoFiniteDiff(; fdtype = Val(:central), fdjtype = Val(:forward), - relstep = 1e-3, absstep = 1e-4, dir = false) + ad = AutoFiniteDiff(; + fdtype = Val(:central), fdjtype = Val(:forward), + relstep = 1.0e-3, absstep = 1.0e-4, dir = false + ) @test ad isa AbstractADType @test ad isa AutoFiniteDiff @test mode(ad) isa ForwardMode @test ad.fdtype === Val(:central) @test ad.fdjtype === Val(:forward) @test ad.fdhtype === Val(:hcentral) - @test ad.relstep == 1e-3 - @test ad.absstep == 1e-4 + @test ad.relstep == 1.0e-3 + @test ad.absstep == 1.0e-4 @test !ad.dir end diff --git a/test/legacy.jl b/test/legacy.jl index 442bca6..33e0398 100644 --- a/test/legacy.jl +++ b/test/legacy.jl @@ -1,15 +1,18 @@ @testset "AutoModelingToolkit" begin ad_sparse1 = @test_deprecated AutoModelingToolkit(; - obj_sparse = true, cons_sparse = false) + obj_sparse = true, cons_sparse = false + ) ad_sparse2 = @test_deprecated AutoModelingToolkit(true, false) ad_dense1 = @test_deprecated AutoModelingToolkit(; - obj_sparse = false, cons_sparse = false) + obj_sparse = false, cons_sparse = false + ) ad_dense2 = @test_deprecated AutoModelingToolkit(false, false) ad_dense3 = @test_deprecated AutoModelingToolkit() @test all( - isa.((ad_sparse1, ad_sparse2, ad_dense1, ad_dense2, ad_dense3), AbstractADType)) + isa.((ad_sparse1, ad_sparse2, ad_dense1, ad_dense2, ad_dense3), AbstractADType) + ) @test all(isa.((ad_sparse1, ad_sparse2), AutoSparse{<:AutoSymbolics})) @test all(isa.((ad_dense1, ad_dense2, ad_dense3), AutoSymbolics)) end @@ -41,7 +44,8 @@ end @testset "AutoSparsePolyesterForwardDiff" begin ad = @test_deprecated AutoSparsePolyesterForwardDiff(; - chunksize = 10, tag = CustomTag()) + chunksize = 10, tag = CustomTag() + ) @test ad isa AbstractADType @test dense_ad(ad) isa AutoPolyesterForwardDiff{10, CustomTag} end diff --git a/test/misc.jl b/test/misc.jl index 95c73bc..a15cb10 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -27,42 +27,42 @@ They do not correspond to proper use of ADTypes constructors. Please refer to the docstrings for that. =# for backend in [ - # dense - ADTypes.AutoChainRules(; ruleconfig = :rc), - ADTypes.AutoDiffractor(), - ADTypes.AutoEnzyme(), - ADTypes.AutoEnzyme(mode = :forward), - ADTypes.AutoEnzyme(function_annotation = Val{:forward}), - ADTypes.AutoEnzyme(mode = :reverse, function_annotation = Val{:duplicated}), - ADTypes.AutoFastDifferentiation(), - ADTypes.AutoFiniteDiff(), - ADTypes.AutoFiniteDiff(fdtype = :fd, fdjtype = :fdj, fdhtype = :fdh), - ADTypes.AutoFiniteDifferences(; fdm = :fdm), - ADTypes.AutoForwardDiff(), - ADTypes.AutoForwardDiff(chunksize = 3, tag = :tag), - ADTypes.AutoGTPSA(), - ADTypes.AutoGTPSA(; descriptor = Val(:descriptor)), - ADTypes.AutoMooncake(), - ADTypes.AutoMooncake(; config = :config), - ADTypes.AutoMooncakeForward(), - ADTypes.AutoMooncakeForward(; config = :config), - ADTypes.AutoPolyesterForwardDiff(), - ADTypes.AutoPolyesterForwardDiff(chunksize = 3, tag = :tag), - ADTypes.AutoReverseDiff(), - ADTypes.AutoReverseDiff(compile = true), - ADTypes.AutoSymbolics(), - ADTypes.AutoTapir(), - ADTypes.AutoTapir(safe_mode = false), - ADTypes.AutoTracker(), - ADTypes.AutoZygote(), - # sparse - ADTypes.AutoSparse(ADTypes.AutoForwardDiff()), - ADTypes.AutoSparse( - ADTypes.AutoForwardDiff(); - sparsity_detector = FakeSparsityDetector(), - coloring_algorithm = FakeColoringAlgorithm() - ) -] + # dense + ADTypes.AutoChainRules(; ruleconfig = :rc), + ADTypes.AutoDiffractor(), + ADTypes.AutoEnzyme(), + ADTypes.AutoEnzyme(mode = :forward), + ADTypes.AutoEnzyme(function_annotation = Val{:forward}), + ADTypes.AutoEnzyme(mode = :reverse, function_annotation = Val{:duplicated}), + ADTypes.AutoFastDifferentiation(), + ADTypes.AutoFiniteDiff(), + ADTypes.AutoFiniteDiff(fdtype = :fd, fdjtype = :fdj, fdhtype = :fdh), + ADTypes.AutoFiniteDifferences(; fdm = :fdm), + ADTypes.AutoForwardDiff(), + ADTypes.AutoForwardDiff(chunksize = 3, tag = :tag), + ADTypes.AutoGTPSA(), + ADTypes.AutoGTPSA(; descriptor = Val(:descriptor)), + ADTypes.AutoMooncake(), + ADTypes.AutoMooncake(; config = :config), + ADTypes.AutoMooncakeForward(), + ADTypes.AutoMooncakeForward(; config = :config), + ADTypes.AutoPolyesterForwardDiff(), + ADTypes.AutoPolyesterForwardDiff(chunksize = 3, tag = :tag), + ADTypes.AutoReverseDiff(), + ADTypes.AutoReverseDiff(compile = true), + ADTypes.AutoSymbolics(), + ADTypes.AutoTapir(), + ADTypes.AutoTapir(safe_mode = false), + ADTypes.AutoTracker(), + ADTypes.AutoZygote(), + # sparse + ADTypes.AutoSparse(ADTypes.AutoForwardDiff()), + ADTypes.AutoSparse( + ADTypes.AutoForwardDiff(); + sparsity_detector = FakeSparsityDetector(), + coloring_algorithm = FakeColoringAlgorithm() + ), + ] println(backend) end diff --git a/test/public.jl b/test/public.jl index 5b20b29..b8ed0c6 100644 --- a/test/public.jl +++ b/test/public.jl @@ -18,6 +18,6 @@ public_symbols = ( :KnownHessianSparsityDetector, # Matrix coloring :coloring_algorithm, - :NoColoringAlgorithm + :NoColoringAlgorithm, ) @test public_symbols ⊆ names(ADTypes) diff --git a/test/runtests.jl b/test/runtests.jl index b4a5f5b..c04d2ac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,26 +1,26 @@ using ADTypes using ADTypes: AbstractADType, - mode, - ForwardMode, - ForwardOrReverseMode, - ReverseMode, - SymbolicMode + mode, + ForwardMode, + ForwardOrReverseMode, + ReverseMode, + SymbolicMode using ADTypes: dense_ad, - NoSparsityDetector, - KnownJacobianSparsityDetector, - KnownHessianSparsityDetector, - sparsity_detector, - jacobian_sparsity, - hessian_sparsity, - NoColoringAlgorithm, - coloring_algorithm, - column_coloring, - row_coloring, - symmetric_coloring + NoSparsityDetector, + KnownJacobianSparsityDetector, + KnownHessianSparsityDetector, + sparsity_detector, + jacobian_sparsity, + hessian_sparsity, + NoColoringAlgorithm, + coloring_algorithm, + column_coloring, + row_coloring, + symmetric_coloring using Aqua: Aqua using ChainRulesCore: ChainRulesCore, RuleConfig, - HasForwardsMode, HasReverseMode, - NoForwardsMode, NoReverseMode + HasForwardsMode, HasReverseMode, + NoForwardsMode, NoReverseMode using EnzymeCore: EnzymeCore using JET: JET using Test @@ -51,7 +51,7 @@ function every_ad() AutoSymbolics(), AutoTapir(), AutoTracker(), - AutoZygote() + AutoZygote(), ] end @@ -63,8 +63,10 @@ function every_ad_with_options() AutoEnzyme(mode = :forward), AutoFastDifferentiation(), AutoFiniteDiff(), - AutoFiniteDiff(fdtype = :fd, fdjtype = :fdj, fdhtype = :fdh, - relstep = 1, absstep = 2, dir = false), + AutoFiniteDiff( + fdtype = :fd, fdjtype = :fdj, fdhtype = :fdh, + relstep = 1, absstep = 2, dir = false + ), AutoFiniteDifferences(; fdm = :fdm), AutoForwardDiff(), AutoForwardDiff(chunksize = 3, tag = :tag), @@ -80,13 +82,13 @@ function every_ad_with_options() AutoTapir(), AutoTapir(safe_mode = false), AutoTracker(), - AutoZygote() + AutoZygote(), ] end ## Tests -@testset verbose=true "ADTypes.jl" begin +@testset verbose = true "ADTypes.jl" begin if VERSION >= v"1.10" @testset "Aqua.jl" begin Aqua.test_all(ADTypes; deps_compat = (check_extras = false,))