@@ -52,7 +52,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
5252 PrecomputedJacobianColorvec (; jac_prototype = J_sparsity, row_colorvec, col_colorvec)]
5353
5454@testset " High-Level API" begin
55- @testset " Sparsity Detection: $(nameof (typeof (sd))) - $( isa (ad, AutoSparse) ? $ ( nameof ( typeof ( dense_ad (ad)))) : " " ) " for sd in SPARSITY_DETECTION_ALGS
55+ @testset " Sparsity Detection: $(nameof (typeof (sd))) " for sd in SPARSITY_DETECTION_ALGS
5656 @info " Sparsity Detection: $(nameof (typeof (sd))) "
5757 @info " Out of Place Function"
5858
@@ -122,11 +122,10 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
122122 @info " Inplace Place Function"
123123
124124 @testset " sparse_jacobian $(nameof (typeof (difftype))) : In place" for difftype in (
125- AutoSparse (AutoForwardDiff ()),
126- AutoForwardDiff (), AutoSparse {<:AutoForwardDiff} (; chunksize = 0 ),
127- AutoForwardDiff (; chunksize = 0 ), AutoSparse (AutoForwardDiff (;
128- chunksize = 4 )),
129- AutoForwardDiff (; chunksize = 4 ), AutoSparse (AutoFiniteDiff ()), AutoFiniteDiff (),
125+ AutoSparse (AutoForwardDiff ()), AutoForwardDiff (),
126+ AutoSparse (AutoForwardDiff (; chunksize = 0 )), AutoForwardDiff (; chunksize = 0 ),
127+ AutoSparse (AutoForwardDiff (; chunksize = 4 )), AutoForwardDiff (; chunksize = 4 ),
128+ AutoSparse (AutoFiniteDiff ()), AutoFiniteDiff (),
130129 AutoEnzyme (), AutoSparse (AutoEnzyme ()))
131130 y = similar (x)
132131 cache = sparse_jacobian_cache (difftype, sd, fdiff, y, x)
@@ -195,35 +194,31 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
195194 end
196195end
197196
198- @static if VERSION ≥ v " 1.9"
199- using AllocCheck
200- end
197+ using AllocCheck
201198
202- @static if VERSION ≥ v " 1.9"
203- # Testing that the non-sparse jacobian's are non-allocating.
204- fvcat (x) = vcat (x, x)
199+ # Testing that the non-sparse jacobian's are non-allocating.
200+ fvcat (x) = vcat (x, x)
205201
206- x_sa = @SVector randn (Float32, 10 )
202+ x_sa = @SVector randn (Float32, 10 )
207203
208- J_true_sa = ForwardDiff. jacobian (fvcat, x_sa)
204+ J_true_sa = ForwardDiff. jacobian (fvcat, x_sa)
209205
210- AllocCheck. @check_allocs function __sparse_jacobian_no_allocs (ad, sd, f:: F , x) where {F}
211- return sparse_jacobian (ad, sd, f, x)
212- end
206+ AllocCheck. @check_allocs function __sparse_jacobian_no_allocs (ad, sd, f:: F , x) where {F}
207+ return sparse_jacobian (ad, sd, f, x)
208+ end
213209
214- @testset " Static Arrays" begin
215- @testset " No Allocations: $(difftype) " for difftype in (
216- AutoSparse (AutoForwardDiff ()),
217- AutoForwardDiff ())
218- J = __sparse_jacobian_no_allocs (difftype, NoSparsityDetection (), fvcat, x_sa)
219- @test J ≈ J_true_sa
220- end
210+ @testset " Static Arrays" begin
211+ @testset " No Allocations: $(difftype) " for difftype in (
212+ AutoSparse (AutoForwardDiff ()),
213+ AutoForwardDiff ())
214+ J = __sparse_jacobian_no_allocs (difftype, NoSparsityDetection (), fvcat, x_sa)
215+ @test J ≈ J_true_sa
216+ end
221217
222- @testset " Other Backends: $(difftype) " for difftype in (AutoSparse (AutoZygote ()),
223- AutoZygote (), AutoSparse (AutoEnzyme ()), AutoEnzyme (), AutoSparse (AutoFiniteDiff ()),
224- AutoFiniteDiff ())
225- J = sparse_jacobian (difftype, NoSparsityDetection (), fvcat, x_sa)
226- @test J ≈ J_true_sa
227- end
218+ @testset " Other Backends: $(difftype) " for difftype in (AutoSparse (AutoZygote ()),
219+ AutoZygote (), AutoSparse (AutoEnzyme ()), AutoEnzyme (), AutoSparse (AutoFiniteDiff ()),
220+ AutoFiniteDiff ())
221+ J = sparse_jacobian (difftype, NoSparsityDetection (), fvcat, x_sa)
222+ @test J ≈ J_true_sa
228223 end
229224end
0 commit comments