Skip to content

Commit 71eed5f

Browse files
authored
Use FiniteDiff.finite_difference_jacobian!
1 parent 71bbd1c commit 71eed5f

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

  • DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt

DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt/onearg.jl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,7 @@ function DI.jacobian!(
403403
DI.check_prep(f, prep, backend, x, contexts...)
404404
(; relstep, absstep, dir) = prep
405405
fc = DI.fix_tail(f, map(DI.unwrap, contexts)...)
406-
return copyto!(
407-
jac,
408-
finite_difference_jacobian(
409-
fc, x, prep.cache; jac_prototype = jac, relstep, absstep, dir
410-
),
411-
)
406+
return finite_difference_jacobian!(jac, fc, x, prep.cache; relstep, absstep, dir)
412407
end
413408

414409
function DI.value_and_jacobian!(
@@ -425,12 +420,7 @@ function DI.value_and_jacobian!(
425420
y = fc(x)
426421
return (
427422
y,
428-
copyto!(
429-
jac,
430-
finite_difference_jacobian(
431-
fc, x, prep.cache, y; jac_prototype = jac, relstep, absstep, dir
432-
),
433-
),
423+
finite_difference_jacobian!(jac, fc, x, prep.cache, y; relstep, absstep, dir),
434424
)
435425
end
436426

0 commit comments

Comments
 (0)