Implement partials/value for complex duals#732
Implement partials/value for complex duals#732dlfivefifty wants to merge 2 commits intoJuliaDiff:masterfrom
Conversation
|
Are these the desired return types? julia> ForwardDiff.partials(ForwardDiff.Dual(1,2) + im*ForwardDiff.Dual(3,4))
1-element Vector{Complex{Int64}}:
2 + 4im
julia> ForwardDiff.partials(1 + im)
0-element ForwardDiff.Partials{0, Complex{Int64}}One alternative is julia> @eval ForwardDiff @inline partials(d::Complex{<:Dual}) = Partials(map(complex, d.re.partials.values, d.im.partials.values))
partials (generic function with 13 methods)
julia> ForwardDiff.partials(ForwardDiff.Dual(1,2) + im*ForwardDiff.Dual(3,4))
1-element Partials{1, Complex{Int64}}:
2 + 4im |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #732 +/- ##
==========================================
- Coverage 89.57% 85.90% -3.68%
==========================================
Files 11 10 -1
Lines 969 922 -47
==========================================
- Hits 868 792 -76
- Misses 101 130 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Ah yes you are right, it is better to return a |
|
I don't swear this is better, it just needs some thought. Are there any paths by which |
|
Given that nothing is currently calling |
At the moment values/partials give useless (and probably "wrong") answers for complex-duals:
This PR implements correct versions of these functions.