Skip to content

Can't take gradient of complex-valued functions #251

@araujoms

Description

@araujoms

Jacobian works fine, though, so FiniteDifferences can do it, it just refuses to reshape the answer into a convenient format for some reason:

julia> fdm = central_fdm(5, 1);

julia> z = randn(ComplexF64)
0.20329027967321606 - 0.33123337931888125im

julia> jacobian(fdm, x -> z*x, randn())[1]
2×1 Matrix{Float64}:
  0.20329027967321567
 -0.3312333793188763

julia> jacobian(fdm, x -> z*x, randn(ComplexF64))[1]
2×2 Matrix{Float64}:
  0.20329   0.331233
 -0.331233  0.20329

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions