Skip to content

Commit e016b5e

Browse files
committed
Remove or sanitize inbounds
1 parent a984510 commit e016b5e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

ext/SparseDiffToolsPolyesterExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function polyesterforwarddiff_color_jacobian(J::AbstractMatrix{<:Number}, f::F,
5757
if colorvec[cols_index[idx]] == color_i]
5858
rows_index_c = rows_index[pick_inds]
5959
cols_index_c = cols_index[pick_inds]
60-
@inbounds @simd for i in 1:length(rows_index_c)
60+
@simd for i in eachindex(rows_index_c, cols_index_c)
6161
J[rows_index_c[i], cols_index_c[i]] = dx[rows_index_c[i]]
6262
end
6363
color_i += 1

src/coloring/matrix2graph.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function matrix2graph(sparse_matrix::AbstractSparseMatrix{<:Number},
4545

4646
if partition_by_rows
4747
rows_by_cols = _rows_by_cols(rows_index, cols_index)
48-
@inbounds for (cur_row, cur_col) in zip(rows_index, cols_index)
48+
for (cur_row, cur_col) in zip(rows_index, cols_index)
4949
if !isempty(rows_by_cols[cur_col])
5050
for next_row in rows_by_cols[cur_col]
5151
if next_row < cur_row
@@ -56,7 +56,7 @@ function matrix2graph(sparse_matrix::AbstractSparseMatrix{<:Number},
5656
end
5757
else
5858
cols_by_rows = _cols_by_rows(rows_index, cols_index)
59-
@inbounds for (cur_row, cur_col) in zip(rows_index, cols_index)
59+
for (cur_row, cur_col) in zip(rows_index, cols_index)
6060
if !isempty(cols_by_rows[cur_row])
6161
for next_col in cols_by_rows[cur_row]
6262
if next_col < cur_col

src/differentiation/compute_jacobian_ad.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
366366
partial_i = p[i]
367367

368368
if vect isa Array
369-
@inbounds @simd ivdep for j in eachindex(vect)
369+
@inbounds @simd ivdep for j in eachindex(vect, vecx, partials_i)
370370
vect[j] = eltype(t)(vecx[j], ForwardDiff.Partials(partial_i[j]))
371371
end
372372
else
@@ -377,7 +377,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
377377
if !(sparsity isa Nothing)
378378
for j in 1:chunksize
379379
if dx isa Array
380-
@inbounds @simd for k in eachindex(dx)
380+
@inbounds @simd for k in eachindex(dx, fx)
381381
dx[k] = partials(fx[k], j)
382382
end
383383
else
@@ -429,7 +429,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
429429
col_index = (i - 1) * chunksize + j
430430
(col_index > ncols) && return J
431431
if J isa Array
432-
@inbounds @simd for k in 1:size(J, 1)
432+
@simd for k in axes(J, 1)
433433
J[k, col_index] = partials(vecfx[k], j)
434434
end
435435
else

0 commit comments

Comments
 (0)