@@ -948,7 +948,7 @@ dt: the time step
948948
949949```julia
950950ImplicitDiscreteFunction{iip,specialize}(f;
951- analytic = __has_analytic(f) ? f.analytic : nothing,
951+ analytic = __has_analytic(f) ? f.analytic : nothing,
952952 resid_prototype = __has_resid_prototype(f) ? f.resid_prototype : nothing)
953953```
954954
@@ -2107,7 +2107,7 @@ A representation of a ODE function `f` with inputs, defined by:
21072107```math
21082108\f rac{dx}{dt} = f(x, u, p, t)
21092109```
2110- where `x` are the states of the system and `u` are the inputs (which may represent
2110+ where `x` are the states of the system and `u` are the inputs (which may represent
21112111different things in different contexts, such as control variables in optimal control).
21122112
21132113Includes all of its related functions, such as the Jacobian of `f`, its gradient
@@ -2134,7 +2134,7 @@ ODEInputFunction{iip, specialize}(f;
21342134 sys = __has_sys(f) ? f.sys : nothing)
21352135```
21362136
2137- `f` should be given as `f(x_out,x,u,p,t)` or `out = f(x,u,p,t)`.
2137+ `f` should be given as `f(x_out,x,u,p,t)` or `out = f(x,u,p,t)`.
21382138See the section on `iip` for more details on in-place vs out-of-place handling.
21392139
21402140- `mass_matrix`: the mass matrix `M` represented in the BVP function. Can be used
@@ -4199,7 +4199,10 @@ IntervalNonlinearFunction(f::IntervalNonlinearFunction; kwargs...) = f
41994199struct NoAD <: AbstractADType end
42004200
42014201(f:: OptimizationFunction )(args... ) = f. f (args... )
4202- OptimizationFunction (args... ; kwargs... ) = OptimizationFunction {true} (args... ; kwargs... )
4202+ function OptimizationFunction (f, args... ; kwargs... )
4203+ isinplace (f, 2 , outofplace_param_number= 2 )
4204+ OptimizationFunction {true} (f, args... ; kwargs... )
4205+ end
42034206
42044207function OptimizationFunction {iip} (f, adtype:: AbstractADType = NoAD ();
42054208 grad = nothing , fg = nothing , hess = nothing , hv = nothing , fgh = nothing ,
@@ -4251,8 +4254,9 @@ end
42514254(f:: MultiObjectiveOptimizationFunction )(args... ) = f. f (args... )
42524255
42534256# Convenience constructor
4254- function MultiObjectiveOptimizationFunction (args... ; kwargs... )
4255- MultiObjectiveOptimizationFunction {true} (args... ; kwargs... )
4257+ function MultiObjectiveOptimizationFunction (f, args... ; kwargs... )
4258+ isinplace (f, 3 )
4259+ MultiObjectiveOptimizationFunction {true} (f, args... ; kwargs... )
42564260end
42574261
42584262# Constructor with keyword arguments
@@ -4339,15 +4343,17 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
43394343 if iip_f
43404344 jac = update_coefficients! # (J,u,p,t)
43414345 else
4342- jac = (u, p, t) -> update_coefficients! (deepcopy (jac_prototype), u, p, t)
4346+ jac_prototype_copy = deepcopy (jac_prototype)
4347+ jac = (u, p, t) -> update_coefficients! (jac_prototype_copy, u, p, t)
43434348 end
43444349 end
43454350
43464351 if bcjac === nothing && isa (bcjac_prototype, AbstractSciMLOperator)
43474352 if iip_bc
43484353 bcjac = update_coefficients! # (J,u,p,t)
43494354 else
4350- bcjac = (u, p, t) -> update_coefficients! (deepcopy (bcjac_prototype), u, p, t)
4355+ bcjac_prototype_copy = deepcopy (bcjac_prototype)
4356+ bcjac = (u, p, t) -> update_coefficients! (bcjac_prototype_copy, u, p, t)
43514357 end
43524358 end
43534359
@@ -4512,15 +4518,17 @@ function DynamicalBVPFunction{iip, specialize, twopoint}(f, bc;
45124518 if iip_f
45134519 jac = update_coefficients! # (J,u,p,t)
45144520 else
4515- jac = (u, p, t) -> update_coefficients! (deepcopy (jac_prototype), u, p, t)
4521+ jac_prototype_copy = deepcopy (jac_prototype)
4522+ jac = (u, p, t) -> update_coefficients! (jac_prototype_copy, u, p, t)
45164523 end
45174524 end
45184525
45194526 if bcjac === nothing && isa (bcjac_prototype, AbstractSciMLOperator)
45204527 if iip_bc
45214528 bcjac = update_coefficients! # (J,u,p,t)
45224529 else
4523- bcjac = (u, p, t) -> update_coefficients! (deepcopy (bcjac_prototype), u, p, t)
4530+ bcjac_prototype_copy = deepcopy (jac_prototype)
4531+ bcjac = (u, p, t) -> update_coefficients! (bcjac_prototype_copy, u, p, t)
45244532 end
45254533 end
45264534
0 commit comments