@@ -10,7 +10,6 @@ __getfield(c::FiniteDiffJacobianCache, ::Val{:jac_prototype}) = c.jac_prototype
10
10
11
11
function sparse_jacobian_cache (fd:: Union{AutoSparseFiniteDiff, AutoFiniteDiff} ,
12
12
sd:: AbstractMaybeSparsityDetection , f:: F , x; fx = nothing ) where {F}
13
- x = __make_mutable (x) # FiniteDiff is bad at handling immutables
14
13
coloring_result = sd (fd, f, x)
15
14
fx = fx === nothing ? similar (f (x)) : fx
16
15
if coloring_result isa NoMatrixColoring
26
25
27
26
function sparse_jacobian_cache (fd:: Union{AutoSparseFiniteDiff, AutoFiniteDiff} ,
28
27
sd:: AbstractMaybeSparsityDetection , f!:: F , fx, x) where {F}
29
- x = __make_mutable (x) # FiniteDiff is bad at handling immutables
30
28
coloring_result = sd (fd, f!, fx, x)
31
29
if coloring_result isa NoMatrixColoring
32
30
cache = FiniteDiff. JacobianCache (x, fx)
@@ -50,3 +48,7 @@ function sparse_jacobian!(J::AbstractMatrix, _, cache::FiniteDiffJacobianCache,
50
48
FiniteDiff. finite_difference_jacobian! (J, f!, x, cache. cache)
51
49
return J
52
50
end
51
+
52
+ function sparse_jacobian_static_array (_, cache:: FiniteDiffJacobianCache , f, x:: SArray )
53
+ return FiniteDiff. finite_difference_jacobian (f, x, cache. cache)
54
+ end
0 commit comments