The in-place jacobian counterpart of #818:
julia> g!(y, x) = (y .= cis(x[1]));
julia> ForwardDiff.jacobian(g!, Vector{ComplexF64}(undef, 2), [0.0])
ERROR: ArgumentError: Cannot create a dual over scalar type ComplexF64. If the type behaves as a scalar, define ForwardDiff.can_dual(::Type{ComplexF64}) = true.
JacobianConfig(f!, y, x) leaves the output eltype Y unconstrained and allocates similar(y, Dual{T,Y,N}), so for a complex y it tries to build a dual over ComplexF64. It should buffer as Complex{Dual{T,real(Y),N}}, which is how the package already represents a complex value carrying derivative information.
PR #831 adds a dual_buffer_eltype helper for exactly this, so the config side becomes a one-line change once that lands. The extraction side needs #830.
The in-place
jacobiancounterpart of #818:JacobianConfig(f!, y, x)leaves the output eltypeYunconstrained and allocatessimilar(y, Dual{T,Y,N}), so for a complexyit tries to build a dual overComplexF64. It should buffer asComplex{Dual{T,real(Y),N}}, which is how the package already represents a complex value carrying derivative information.PR #831 adds a
dual_buffer_eltypehelper for exactly this, so the config side becomes a one-line change once that lands. The extraction side needs #830.