Skip to content

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

Closed

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

Activity

  1. araujoms commented on Jun 10, 2026

    @araujoms
    Author

    Nevermind, that doesn't make much sense nor would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions