@@ -61,7 +61,7 @@ function construct_jacobian_cache(
6161 end
6262
6363 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)
6565 else
6666 if f. jac_prototype === nothing
6767 # While this is technically wasteful, it gives out the type of the Jacobian
@@ -96,7 +96,7 @@ function construct_jacobian_cache(
9696 linsolve = missing
9797)
9898 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 )
100100 end
101101 if autodiff === nothing
102102 throw (ArgumentError (" `autodiff` argument to `construct_jacobian_cache` must be \
@@ -124,10 +124,12 @@ function InternalAPI.reinit!(cache::JacobianCache; p = cache.p, kwargs...)
124124 cache. p = p
125125end
126126
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" )
130131
132+ # Core Computation
131133# # Numbers
132134function (cache:: JacobianCache{<:Number} )(u)
133135 cache. stats. njacs += 1
@@ -168,6 +170,10 @@ function (cache::JacobianCache)(u)
168170 end
169171end
170172
173+ function (cache:: JacobianCache{<:JacobianOperator} )(u)
174+ return StatefulJacobianOperator (cache. J, u, cache. p)
175+ end
176+
171177# Sparse Automatic Differentiation
172178function construct_concrete_adtype (f:: NonlinearFunction , ad:: AbstractADType )
173179 if f. sparsity === nothing
0 commit comments