Skip to content

Ambiguity with forwarddiff ? #103

@lrnv

Description

@lrnv

In lrnv/Copulas.jl#301,

we have a

julia> using ForwardDiff, TaylorDiff

julia> x = ForwardDiff.Dual(1, 1)
Dual{Nothing}(1,1)

julia> y = ForwardDiff.Dual(1,1)
Dual{Nothing}(1,1)

julia> TaylorDiff.derivative(z -> z*y, x, one(x), Val{3}())
ERROR: MethodError: *(::TaylorScalar{ForwardDiff.Dual{Nothing, Int64, 1}, 3}, ::ForwardDiff.Dual{Nothing, Int64, 1}) is ambiguous.

Candidates:
  *(a::TaylorScalar, b::Number)
    @ TaylorDiff ~\.julia\packages\TaylorDiff\N6Pcf\src\primitive.jl:119
  *(x::Real, y::ForwardDiff.Dual{Ty}) where Ty
    @ ForwardDiff ~\.julia\packages\ForwardDiff\Or6Qh\src\dual.jl:149

Possible fix, define
  *(::TaylorScalar, ::ForwardDiff.Dual{Ty}) where Ty

Can we force the choice here between the two somehow, so the code goes through ? eg by defining

*(::TaylorScalar{ForwardDiff.Dual{Ty}}, ::ForwardDiff.Dual{Ty}) where Ty

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions