ForwardDiff.jl icon indicating copy to clipboard operation
ForwardDiff.jl copied to clipboard

Relax type signatures on multiplication with partials

Open staticfloat opened this issue 7 years ago • 1 comments

We need this for TPU work so that things like XRTArrays can be multiplied in.

staticfloat avatar Jan 25 '19 01:01 staticfloat

We need some versions of these methods with some type restrictions to avoid inevitable ambiguity warnings:

  ...testing Partials{3,Int64}
Error During Test at /home/travis/build/JuliaDiff/ForwardDiff.jl/test/PartialsTest.jl:111
  Test threw exception
  Expression: X * PARTIALS == PARTIALS * X
  MethodError: *(::Float64, ::ForwardDiff.Partials{3,Int64}) is ambiguous. Candidates:
    *(x, partials::ForwardDiff.Partials) in ForwardDiff at /home/travis/build/JuliaDiff/ForwardDiff.jl/src/partials.jl:84
    *(A::Number, B::AbstractArray) in Base at arraymath.jl:52
  Possible fix, define
    *(::Number, ::ForwardDiff.Partials)

Would be nice to just replace Partials with StaticVectors entirely sometime soon since we've already taken on StaticArrays as a dependency

jrevels avatar Feb 16 '19 20:02 jrevels