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 for complex valued function #364

Open
atbug opened this issue Oct 9, 2018 · 5 comments
Open

support for complex valued function #364

atbug opened this issue Oct 9, 2018 · 5 comments

Comments

@atbug
Copy link

atbug commented Oct 9, 2018

IIUC, ForwardDiff.jl does not support complex valued function such as x->exp(im*x). Is there any plan to support this? I believe this is possible since AutoGrad.jl seems to support this.

@fredrikekre
Copy link
Contributor

Ref #157

@atbug
Copy link
Author

atbug commented Oct 9, 2018

I believe #157 is talking about complex arguments, not complex valued functions. Complex values functions should be much simpler since I am talking real arguments.

@devmotion
Copy link
Member

Support for complex-valued functions with real arguments was added in #583:

julia> using ForwardDiff

julia> ForwardDiff.derivative(x->exp(im*x), 1.0)
-0.8414709848078965 + 0.5403023058681398im

@petar-andrejic
Copy link

Support for complex-valued functions with real arguments was added in #583:

julia> using ForwardDiff

julia> ForwardDiff.derivative(x->exp(im*x), 1.0)
-0.8414709848078965 + 0.5403023058681398im

ForwardDiff.gradient etc don't work for complex valued functions of multiple real arguments

@petar-andrejic
Copy link

petar-andrejic commented Nov 25, 2022

e.g.

julia> ForwardDiff.gradient(x->exp(im * x[1]+x[2]), [3.0,2.0])
ERROR: DimensionMismatch: gradient(f, x) expects that f(x) is a real number. Perhaps you meant jacobian(f, x)?

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

4 participants