Skip to content

A trait-based system to handle Wirtinger derivatives #77

Open
@YingboMa

Description

@YingboMa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Complex DifferentiationRelating to any form of complex differentiation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions