@@ -61,7 +61,7 @@ function construct_jacobian_cache(
61
61
end
62
62
63
63
J = if ! needs_jac
64
- StatefulJacobianOperator ( JacobianOperator (prob, fu, u; jvp_autodiff, vjp_autodiff), u, p )
64
+ JacobianOperator (prob, fu, u; jvp_autodiff, vjp_autodiff)
65
65
else
66
66
if f. jac_prototype === nothing
67
67
# While this is technically wasteful, it gives out the type of the Jacobian
@@ -96,7 +96,7 @@ function construct_jacobian_cache(
96
96
linsolve = missing
97
97
)
98
98
if SciMLBase. has_jac (f) || SciMLBase. has_vjp (f) || SciMLBase. has_jvp (f)
99
- return JacobianCache (u , f, fu, u , p, stats, autodiff, nothing )
99
+ return JacobianCache (fu , f, fu, p, stats, autodiff, nothing )
100
100
end
101
101
if autodiff === nothing
102
102
throw (ArgumentError (" `autodiff` argument to `construct_jacobian_cache` must be \
@@ -124,10 +124,12 @@ function InternalAPI.reinit!(cache::JacobianCache; p = cache.p, kwargs...)
124
124
cache. p = p
125
125
end
126
126
127
- # Core Computation
128
- (cache:: JacobianCache )(:: Nothing ) = cache. J
129
- (cache:: JacobianCache{<:Number} )(:: Nothing ) = cache. J
127
+ # Deprecations
128
+ (cache:: JacobianCache{<:Number} )(:: Nothing ) = error (" Please report a bug to NonlinearSolve.jl" )
129
+ (cache:: JacobianCache{<:JacobianOperator} )(:: Nothing ) = error (" Please report a bug to NonlinearSolve.jl" )
130
+ (cache:: JacobianCache )(:: Nothing ) = error (" Please report a bug to NonlinearSolve.jl" )
130
131
132
+ # Core Computation
131
133
# # Numbers
132
134
function (cache:: JacobianCache{<:Number} )(u)
133
135
cache. stats. njacs += 1
@@ -168,6 +170,10 @@ function (cache::JacobianCache)(u)
168
170
end
169
171
end
170
172
173
+ function (cache:: JacobianCache{<:JacobianOperator} )(u)
174
+ return StatefulJacobianOperator (cache. J, u, cache. p)
175
+ end
176
+
171
177
# Sparse Automatic Differentiation
172
178
function construct_concrete_adtype (f:: NonlinearFunction , ad:: AbstractADType )
173
179
if f. sparsity === nothing
0 commit comments