Skip to content

Commit a89c672

Browse files
author
Langwen Huang
committed
add test for non vector input
1 parent 5d6f05f commit a89c672

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/test_ad.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,14 @@ Jsparse = sparse(J)
208208
colors = matrix_colors(J)
209209
forwarddiff_color_jacobian!(J, f, x, colorvec=colors)
210210
forwarddiff_color_jacobian!(Jsparse, f, x, colorvec=colors)
211-
@test J Jsparse
211+
@test J Jsparse
212+
213+
# Non vector input
214+
x = rand(2,2)
215+
oopf(x) = x
216+
iipf(fx,x) = (fx.=x)
217+
J = forwarddiff_color_jacobian(oopf,x)
218+
@test J Matrix(I,4,4)
219+
J = zero(J)
220+
forwarddiff_color_jacobian!(J,iipf,x,dx=similar(x))
221+
@test J Matrix(I,4,4)

0 commit comments

Comments
 (0)