Skip to content

Commit 5d6f05f

Browse files
huanglangwenLangwen Huang
authored andcommitted
fix error when x is a ndarray
1 parent 08ffdde commit 5d6f05f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/differentiation/compute_jacobian_ad.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
8888

8989
vecx = vec(x)
9090

91-
J = jac_prototype isa Nothing ? (sparsity isa Nothing ? false .* dx .* x' : zeros(eltype(x),size(sparsity))) : zero(jac_prototype)
91+
J = jac_prototype isa Nothing ? (sparsity isa Nothing ? false .* vec(dx) .* vecx' : zeros(eltype(x),size(sparsity))) : zero(jac_prototype)
9292
nrows,ncols = size(J)
9393

9494
if !(sparsity isa Nothing)

0 commit comments

Comments
 (0)