Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 9fa3444

Browse files
committed
Fix color index
1 parent 4d0c091 commit 9fa3444

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ext/SparseDiffToolsPolyesterExt.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function polyesterforwarddiff_color_jacobian(J::AbstractMatrix{<:Number}, f::F,
4545
end
4646

4747
batch((length(p), min(length(p), Threads.nthreads()))) do _, start, stop
48+
color_i = (start - 1) * chunksize + 1
4849
for i in start:stop
4950
partial_i = p[i]
50-
color_i = i
5151
t_ = reshape(eltype(t).(vecx, ForwardDiff.Partials.(partial_i)), size(t))
5252
fx = f(t_)
5353
for j in 1:chunksize
@@ -60,10 +60,11 @@ function polyesterforwarddiff_color_jacobian(J::AbstractMatrix{<:Number}, f::F,
6060
@inbounds @simd for i in 1:length(rows_index_c)
6161
J[rows_index_c[i], cols_index_c[i]] = dx[rows_index_c[i]]
6262
end
63+
color_i += 1
6364
end
6465
end
6566
end
6667
return J
6768
end
6869

69-
end
70+
end

ext/SparseDiffToolsPolyesterForwardDiffExt.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ function (alg::ApproximateJacobianSparsity)(
9494
fx, kwargs...)
9595
end
9696

97-
function (alg::ApproximateJacobianSparsity)(ad::AutoSparsePolyesterForwardDiff, f::F, fx, x;
97+
function (alg::ApproximateJacobianSparsity)(
98+
ad::AutoSparsePolyesterForwardDiff, f::F, fx, x;
9899
kwargs...) where {F}
99100
@unpack ntrials, rng = alg
100101
ck = __chunksize(ad, x)

0 commit comments

Comments
 (0)