Skip to content

Commit

Permalink
restore rng_state (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bossart committed Aug 29, 2023
1 parent a51524d commit 7e64147
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/base/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function JacobianFunctionWrapper(
if sparse_retrieve_loop > 0
for _ in 1:sparse_retrieve_loop
temp = zeros(n, n)
rng_state = copy(Random.default_rng())
Jf(temp, x0 + Random.randn(n))
copy!(Random.default_rng(), rng_state)
jac .+= abs.(temp)
end
Jv = SparseArrays.sparse(jac)
Expand Down Expand Up @@ -104,7 +106,9 @@ function JacobianFunctionWrapper(
if sparse_retrieve_loop > 0
for _ in 1:sparse_retrieve_loop
temp = zeros(n, n)
rng_state = copy(Random.default_rng())
Jf(temp, x0 + Random.randn(n))
copy!(Random.default_rng(), rng_state)
jac .+= abs.(temp)
end
Jv = SparseArrays.sparse(jac .+ mass_matrix)
Expand Down

0 comments on commit 7e64147

Please sign in to comment.