Skip to content

Commit d7ef132

Browse files
authored
Safely initialize the inplace Jacobian cache
This fixes support for BigFloat in LsqFit.jl. Making a copy instead of similar ensures that the elements aren't `undef`. This is what previous versions did.
1 parent fa8b3bc commit d7ef132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/objective_types/oncedifferentiable.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function OnceDifferentiable(f, x_seed::AbstractArray, F::AbstractArray, DF::Abst
7878
fdfF = make_fdf(f, x_seed, F)
7979
return OnceDifferentiable(fF, dfF, fdfF, x_seed, F, DF)
8080
else
81-
F2 = similar(F)
81+
F2 = copy(F)
8282
backend = get_adtype(autodiff, chunk)
8383
jac_prep = DI.prepare_jacobian(f, F2, backend, x_seed)
8484
function j!(_j, _x)

0 commit comments

Comments
 (0)