Skip to content

Commit 8ee3c97

Browse files
authored
Default construction of colorvec for JacobianCache
1 parent b1d2b77 commit 8ee3c97

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/finitedifftests.jl

+7
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ df = zero(x)
330330
df_ref = diag(J_ref)
331331
epsilon = zero(x)
332332
forward_cache = FiniteDiff.JacobianCache(x,Val{:forward},eltype(x))
333+
@test forward_cache.colorvec == 1:length(x)
333334
central_cache = FiniteDiff.JacobianCache(x,Val{:central},eltype(x))
334335
complex_cache = FiniteDiff.JacobianCache(x,Val{:complex},eltype(x))
335336
f_in = copy(y)
@@ -435,6 +436,12 @@ f_in = oopf(x)
435436
@test err_func(FiniteDiff.finite_difference_jacobian(oopf, x, complex_cache), J_ref) < 1e-14
436437
end
437438

439+
# Test default colorvec construction
440+
θ = rand(2)
441+
y0 = rand(1)
442+
cache = FiniteDiff.JacobianCache(copy(θ), copy(y0), copy(y0), Val(:forward))
443+
@test cache.colorvec == 1:length(θ)
444+
438445
# Hessian tests
439446

440447
f(x) = sin(x[1]) + cos(x[2])

0 commit comments

Comments
 (0)