@@ -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, 2 , outofplace_param_number= 2 )
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