Skip to content

Commit 1902d93

Browse files
Merge pull request #120 from jClugstor/scimlsensitivity_bug_fix
FixedSizeDiffCache use `Nothing` instead of `nothing`
2 parents 8300ab6 + 667e6ec commit 1902d93

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/PreallocationTools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ end
1111
function FixedSizeDiffCache(u::AbstractArray{T}, siz,
1212
::Type{Val{chunk_size}}) where {T, chunk_size}
1313
x = ArrayInterface.restructure(u,
14-
zeros(ForwardDiff.Dual{nothing, T, chunk_size},
14+
zeros(ForwardDiff.Dual{Nothing, T, chunk_size},
1515
siz...))
1616
xany = Any[]
1717
FixedSizeDiffCache(deepcopy(u), x, xany)

test/core_dispatch.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@ b = PreallocationTools.DiffCache(zeros(4), Val{4}())
164164
c = PreallocationTools.DiffCache(zeros(4), Val{4})
165165
@test structequal(a, b)
166166
@test structequal(a, b)
167+
168+
169+
# FixedSizeDiffCache get_tmp ReinterpretArray test
170+
# Ensures that get_tmp doesn't produce a Reinterpret array in some cases
171+
172+
dual_cache = FixedSizeDiffCache([0.0, 0.0, 0.0], 3)
173+
dl = zeros(ForwardDiff.Dual{Nothing, Float64, 3}, 3)
174+
175+
@test !(get_tmp(dual_cache, dl) isa Base.ReinterpretArray)

0 commit comments

Comments
 (0)