Skip to content

Commit

Permalink
Test ComponentArrays globally and locally
Browse files Browse the repository at this point in the history
  • Loading branch information
adrhill committed Jan 24, 2025
1 parent 4ecbb97 commit c4a24aa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/componentarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ y_comp = ComponentVector(; a=rand(2), b=rand(3))
x = Vector(x_comp)
y = Vector(y_comp)

detector = TracerSparsityDetector()

@test jacobian_sparsity(f_comp, x_comp, detector) == jacobian_sparsity(f, x, detector)
@test jacobian_sparsity(f_comp!, similar(y_comp), x_comp, detector) ==
jacobian_sparsity(f!, similar(y), x, detector)
@test hessian_sparsity(sum f_comp, x_comp, detector) ==
hessian_sparsity(sum f, x, detector)
@testset "$detector" for detector in
(TracerSparsityDetector(), TracerLocalSparsityDetector())
@test jacobian_sparsity(f_comp, x_comp, detector) == jacobian_sparsity(f, x, detector)
@test jacobian_sparsity(f_comp!, similar(y_comp), x_comp, detector) ==
jacobian_sparsity(f!, similar(y), x, detector)
@test hessian_sparsity(sum f_comp, x_comp, detector) ==
hessian_sparsity(sum f, x, detector)
end

0 comments on commit c4a24aa

Please sign in to comment.