Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Merged
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
15 changes: 2 additions & 13 deletions src/differentiation/compute_jacobian_ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ struct ForwardColorJacCache{T,T2,T3,T4,T5,T6}
chunksize::Int
end

function default_chunk_size(maxcolor)
if maxcolor < DEFAULT_CHUNK_THRESHOLD
Val(maxcolor)
else
Val(DEFAULT_CHUNK_THRESHOLD)
end
end

getsize(::Val{N}) where N = N
getsize(N::Integer) = N
void_setindex!(args...) = (setindex!(args...); return)
Expand All @@ -26,7 +18,7 @@ function ForwardColorJacCache(f,x,_chunksize = nothing;
sparsity::Union{AbstractArray,Nothing}=nothing)

if _chunksize isa Nothing
chunksize = default_chunk_size(maximum(colorvec))
chunksize = ForwardDiff.pickchunksize(maximum(colorvec))
else
chunksize = _chunksize
end
Expand Down Expand Up @@ -264,7 +256,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
chunksize = jac_cache.chunksize
color_i = 1
maxcolor = maximum(colorvec)

fill!(J, zero(eltype(J)))

if FiniteDiff._use_findstructralnz(sparsity)
Expand Down Expand Up @@ -325,6 +317,3 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number},
end
return J
end