@@ -52,7 +52,7 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
52
52
PrecomputedJacobianColorvec (; jac_prototype = J_sparsity, row_colorvec, col_colorvec)]
53
53
54
54
@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
56
56
@info " Sparsity Detection: $(nameof (typeof (sd))) "
57
57
@info " Out of Place Function"
58
58
@@ -122,11 +122,10 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
122
122
@info " Inplace Place Function"
123
123
124
124
@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 (),
130
129
AutoEnzyme (), AutoSparse (AutoEnzyme ()))
131
130
y = similar (x)
132
131
cache = sparse_jacobian_cache (difftype, sd, fdiff, y, x)
@@ -195,35 +194,31 @@ SPARSITY_DETECTION_ALGS = [JacPrototypeSparsityDetection(; jac_prototype = J_spa
195
194
end
196
195
end
197
196
198
- @static if VERSION ≥ v " 1.9"
199
- using AllocCheck
200
- end
197
+ using AllocCheck
201
198
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)
205
201
206
- x_sa = @SVector randn (Float32, 10 )
202
+ x_sa = @SVector randn (Float32, 10 )
207
203
208
- J_true_sa = ForwardDiff. jacobian (fvcat, x_sa)
204
+ J_true_sa = ForwardDiff. jacobian (fvcat, x_sa)
209
205
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
213
209
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
221
217
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
228
223
end
229
224
end
0 commit comments