@@ -14,17 +14,17 @@ struct NoMatrixColoring end
14
14
(:: AbstractMaybeSparsityDetection )(:: AbstractADType , args... ; kws... ) = NoMatrixColoring ()
15
15
16
16
# Prespecified Jacobian Structure
17
- function (alg:: JacPrototypeSparsityDetection )(ad:: AbstractSparseADType , args... ; kwargs... )
17
+ function (alg:: JacPrototypeSparsityDetection )(ad:: AutoSparse , args... ; kwargs... )
18
18
J = alg. jac_prototype
19
19
colorvec = matrix_colors (J, alg. alg;
20
- partition_by_rows = ad isa AbstractSparseReverseMode )
20
+ partition_by_rows = mode (ad) isa ReverseMode )
21
21
(nz_rows, nz_cols) = ArrayInterface. findstructralnz (J)
22
22
return MatrixColoringResult (colorvec, J, nz_rows, nz_cols)
23
23
end
24
24
25
25
# Prespecified Colorvecs
26
- function (alg:: PrecomputedJacobianColorvec )(ad:: AbstractSparseADType , args... ; kwargs... )
27
- colorvec = _get_colorvec (alg, ad )
26
+ function (alg:: PrecomputedJacobianColorvec )(ad:: AutoSparse , args... ; kwargs... )
27
+ colorvec = _get_colorvec (alg, mode (ad) )
28
28
J = alg. jac_prototype
29
29
(nz_rows, nz_cols) = ArrayInterface. findstructralnz (J)
30
30
return MatrixColoringResult (colorvec, J, nz_rows, nz_cols)
33
33
# Approximate Jacobian Sparsity Detection
34
34
# # Right now we hardcode it to use `ForwardDiff`
35
35
function (alg:: ApproximateJacobianSparsity )(
36
- ad:: AbstractSparseADType , f:: F , x; fx = nothing ,
36
+ ad:: AutoSparse , f:: F , x; fx = nothing ,
37
37
kwargs... ) where {F}
38
- if ! (ad isa AutoSparseForwardDiff )
39
- if ad isa AutoSparsePolyesterForwardDiff
38
+ if ! (ad isa AutoSparse{ <: AutoForwardDiff } )
39
+ if ad isa AutoSparse{ <: AutoPolyesterForwardDiff }
40
40
@warn " $(ad) is only supported if `PolyesterForwardDiff` is explicitly loaded. Using ForwardDiff instead." maxlog= 1
41
41
else
42
42
@warn " $(ad) support for approximate jacobian not implemented. Using ForwardDiff instead." maxlog= 1
@@ -57,10 +57,10 @@ function (alg::ApproximateJacobianSparsity)(
57
57
fx, kwargs... )
58
58
end
59
59
60
- function (alg:: ApproximateJacobianSparsity )(ad:: AbstractSparseADType , f:: F , fx, x;
60
+ function (alg:: ApproximateJacobianSparsity )(ad:: AutoSparse , f:: F , fx, x;
61
61
kwargs... ) where {F}
62
- if ! (ad isa AutoSparseForwardDiff )
63
- if ad isa AutoSparsePolyesterForwardDiff
62
+ if ! (ad isa AutoSparse{ <: AutoForwardDiff } )
63
+ if ad isa AutoSparse{ <: AutoPolyesterForwardDiff }
64
64
@warn " $(ad) is only supported if `PolyesterForwardDiff` is explicitly loaded. Using ForwardDiff instead." maxlog= 1
65
65
else
66
66
@warn " $(ad) support for approximate jacobian not implemented. Using ForwardDiff instead." maxlog= 1
@@ -81,7 +81,7 @@ function (alg::ApproximateJacobianSparsity)(ad::AbstractSparseADType, f::F, fx,
81
81
end
82
82
83
83
function (alg:: ApproximateJacobianSparsity )(
84
- ad:: AutoSparseFiniteDiff , f:: F , x; fx = nothing ,
84
+ ad:: AutoSparse{<:AutoFiniteDiff} , f:: F , x; fx = nothing ,
85
85
kwargs... ) where {F}
86
86
@unpack ntrials, rng = alg
87
87
fx = fx === nothing ? f (x) : fx
@@ -98,7 +98,7 @@ function (alg::ApproximateJacobianSparsity)(
98
98
fx, kwargs... )
99
99
end
100
100
101
- function (alg:: ApproximateJacobianSparsity )(ad:: AutoSparseFiniteDiff , f!:: F , fx, x;
101
+ function (alg:: ApproximateJacobianSparsity )(ad:: AutoSparse{<:AutoFiniteDiff} , f!:: F , fx, x;
102
102
kwargs... ) where {F}
103
103
@unpack ntrials, rng = alg
104
104
cache = FiniteDiff. JacobianCache (x, fx)
0 commit comments