JuliaDiff / JuliaDiff/ChainRulesCore.jl

A trait-based system to handle Wirtinger derivatives

Open
#77 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Complex Differentiation
Dominant language
Julia
Stars
267
Forks
66
PR merge metrics
No merged PRs in 30d

Description

While writing ForwardDiff2.jl I have encountered a problem with nested differentiation with the Wirtinger derivative.

Say if I have

x = Dual(Dual(1+1im, 1+0im), 1+0im)

how can I make hypot(value(x)) dispatch to the right place if there is

@scalar_rule(hypot(x::Real), sign(x))
@scalar_rule(hypot(x::Complex), Wirtinger(x' / 2Ω, x / 2Ω))

Neither Dual <: Number or Dual <: Real would work.

https://github.com/JuliaDiff/ChainRules.jl/blob/146d031235b28265772b8c0b98ed54b812c39316/src/rulesets/Base/base.jl#L59-L60

Maybe we need to have a trait-based system to handle Wirtinger derivatives?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the nested Dual example and the referenced ChainRules.jl src/rulesets/Base/base.jl lines 59-60, then compare the Real and Complex hypot rules shown here. The issue does not define a specific acceptance criterion, so a useful outcome would first be a concrete, validated direction for handling the dispatch ambiguity.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.