Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit bb80238

Browse files
committed
Add test of pre-allocated Jacobian with oop f for BandedMatrix.
1 parent 1f55f52 commit bb80238

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/test_ad.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using ForwardDiff: Dual, jacobian
33
using SparseArrays, Test
44
using LinearAlgebra
55
using BlockBandedMatrices
6+
using BandedMatrices
67
using StaticArrays
78

89
fcalls = 0
@@ -123,6 +124,13 @@ forwarddiff_color_jacobian(_oop_jacout, oopf, x; colorvec = repeat(1:3,10), spar
123124
@test typeof(_oop_jacout) == typeof(_J)
124125
@test fcalls == 1
125126

127+
_oop_jacout = BandedMatrix(1.01 .* _oop_jacout) # check w/BandedMatrix instead of sparse
128+
fcalls = 0
129+
forwarddiff_color_jacobian(_oop_jacout, oopf, x; colorvec = repeat(1:3,10), sparsity = _J, jac_prototype = _J)
130+
@test _oop_jacout J
131+
@test isa(_oop_jacout, BandedMatrix)
132+
@test fcalls == 1
133+
126134
@info "4th passed"
127135

128136
fcalls = 0

0 commit comments

Comments
 (0)