Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/SparseDiffToolsPolyesterExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ function polyesterforwarddiff_color_jacobian(J::AbstractMatrix{<:Number}, f::F,
rows_index = [rows_index[i] for i in 1:length(rows_index)]
cols_index = [cols_index[i] for i in 1:length(cols_index)]
else
rows_index = 1:nrows
cols_index = 1:ncols
cartind = vec(CartesianIndices(x))
rows_index = Base.Iterators.map(first ∘ Tuple, cartind)
cols_index = Base.Iterators.map(last ∘ Tuple, cartind)
end

if J isa AbstractSparseMatrix
Expand Down
5 changes: 3 additions & 2 deletions src/differentiation/compute_jacobian_ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
if FiniteDiff._use_findstructralnz(sparsity)
rows_index, cols_index = ArrayInterface.findstructralnz(sparsity)
else
rows_index = 1:size(J, 1)
cols_index = 1:size(J, 2)
cartind = vec(CartesianIndices(x))
rows_index = Base.Iterators.map(first ∘ Tuple, cartind)
cols_index = Base.Iterators.map(last ∘ Tuple, cartind)
end

# fast path if J and sparsity are both AbstractSparseMatrix and have the same sparsity pattern
Expand Down
Loading