-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
ForwardDiff.jl fail on ode with complex numbers #858
Comments
Changing to: @inline function promote_u0(u0, p, t0)
if !(eltype(u0) <: ForwardDiff.Dual)
T = anyeltypedual(p)
T === Any && return u0
if T <: ForwardDiff.Dual
Ts = promote_type(T, eltype(u0))
return Ts.(u0)
end
end
u0
end doesn't do anything here. So I'm inclined to say that this is an upstream issue with how ForwardDiff + Complex functions and I'm not sure what kind of nicety we can add here except maybe an FAQ entry explaining what to do with complex. |
For me it seems to solve the ambiguity by making
Not sure about the switch on the having a cllback as in DiffEqBase.jl/src/forwarddiff.jl Lines 223 to 230 in c5154b8
|
But |
I think that |
PR it with an example that's fixed. I don't think I'm following the whole train, but it sounds like a reasonable fix at a high level. |
Handled in #860 |
Differentiating some (real valued) cost function by real parameters fails when the ode in the cost function has complex numbers.
This happens in
promote_u0
DiffEqBase.jl/src/forwarddiff.jl
Lines 207 to 216 in c5154b8
When trying to convert the complex
u0
toForwardDiff.Dual
.A workaround is to convert
u0
toComplex{ForwardDiff.Dual{...}}
.Is there a reason not to switch between them?
Example;
errors with
ForwardDiff.Dual{ForwardDiff.Tag{typeof(loss_fail), Float64}, Float64, 3}(::ComplexF64) is ambiguous
Workaround;
The text was updated successfully, but these errors were encountered: