@@ -948,7 +948,7 @@ dt: the time step
948
948
949
949
```julia
950
950
ImplicitDiscreteFunction{iip,specialize}(f;
951
- analytic = __has_analytic(f) ? f.analytic : nothing,
951
+ analytic = __has_analytic(f) ? f.analytic : nothing,
952
952
resid_prototype = __has_resid_prototype(f) ? f.resid_prototype : nothing)
953
953
```
954
954
@@ -2107,7 +2107,7 @@ A representation of a ODE function `f` with inputs, defined by:
2107
2107
```math
2108
2108
\f rac{dx}{dt} = f(x, u, p, t)
2109
2109
```
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
2111
2111
different things in different contexts, such as control variables in optimal control).
2112
2112
2113
2113
Includes all of its related functions, such as the Jacobian of `f`, its gradient
@@ -2134,7 +2134,7 @@ ODEInputFunction{iip, specialize}(f;
2134
2134
sys = __has_sys(f) ? f.sys : nothing)
2135
2135
```
2136
2136
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)`.
2138
2138
See the section on `iip` for more details on in-place vs out-of-place handling.
2139
2139
2140
2140
- `mass_matrix`: the mass matrix `M` represented in the BVP function. Can be used
@@ -4199,7 +4199,10 @@ IntervalNonlinearFunction(f::IntervalNonlinearFunction; kwargs...) = f
4199
4199
struct NoAD <: AbstractADType end
4200
4200
4201
4201
(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
4203
4206
4204
4207
function OptimizationFunction {iip} (f, adtype:: AbstractADType = NoAD ();
4205
4208
grad = nothing , fg = nothing , hess = nothing , hv = nothing , fgh = nothing ,
@@ -4251,8 +4254,9 @@ end
4251
4254
(f:: MultiObjectiveOptimizationFunction )(args... ) = f. f (args... )
4252
4255
4253
4256
# 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... )
4256
4260
end
4257
4261
4258
4262
# Constructor with keyword arguments
@@ -4339,15 +4343,17 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
4339
4343
if iip_f
4340
4344
jac = update_coefficients! # (J,u,p,t)
4341
4345
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)
4343
4348
end
4344
4349
end
4345
4350
4346
4351
if bcjac === nothing && isa (bcjac_prototype, AbstractSciMLOperator)
4347
4352
if iip_bc
4348
4353
bcjac = update_coefficients! # (J,u,p,t)
4349
4354
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)
4351
4357
end
4352
4358
end
4353
4359
@@ -4512,15 +4518,17 @@ function DynamicalBVPFunction{iip, specialize, twopoint}(f, bc;
4512
4518
if iip_f
4513
4519
jac = update_coefficients! # (J,u,p,t)
4514
4520
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)
4516
4523
end
4517
4524
end
4518
4525
4519
4526
if bcjac === nothing && isa (bcjac_prototype, AbstractSciMLOperator)
4520
4527
if iip_bc
4521
4528
bcjac = update_coefficients! # (J,u,p,t)
4522
4529
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)
4524
4532
end
4525
4533
end
4526
4534
0 commit comments