Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support derivative(f, ::Complex) #675

Open
dlfivefifty opened this issue Nov 24, 2023 · 1 comment
Open

Support derivative(f, ::Complex) #675

dlfivefifty opened this issue Nov 24, 2023 · 1 comment

Comments

@dlfivefifty
Copy link
Contributor

I think the following should work:

julia> ForwardDiff.derivative(identity, 1+im)
ERROR: DimensionMismatch: derivative(f, x) expects that x is a real number (does not support Wirtinger derivatives). Separate real and imaginary parts of the input.
Stacktrace:
 [1] derivative(f::Function, x::Complex{Int64})
   @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/derivative.jl:73
 [2] top-level scope
   @ REPL[35]:1

Note that https://github.com/JuliaDiff/ForwardDiff.jl/issues?q=is%3Aissue+is%3Aclosed+complex supports Complex{<:Dual} so the implementation would be really straightforward.

I was surprised not to see a discussion on this. Would a PR adding automatic support for complex differentiation be merged?

@ranocha
Copy link
Contributor

ranocha commented May 23, 2024

I also cam across this - it would be quite nice, also for classroom demonstration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants