Skip to content

inference problem with broadcasting and / #682

Closed
@tpapp

Description

@tpapp

This is an MWE isolated from a larger piece of code:

using ForwardDiff, StaticArrays, Test
_dual(x) = ForwardDiff.Dual(x, 1 + x) # for testing
f(η, B, R, 𝑢, σ, C) =.* (B .- R) ./ 𝑢 .- C) ./ σ
A = fill(1.0, SMatrix{2, 2})
b = 1.0
@inferred f(A, b, A, b, b, A)        # infers fine
@inferred f(A, b, A, _dual(b), b, A) # does not infer

Version information:

julia> versioninfo()
Julia Version 1.3.0-rc4.1
Commit 8c4656b97a (2019-10-15 14:08 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_CMDSTAN_HOME = /home/tamas/src/cmdstan/

(v1) pkg> st StaticArrays ForwardDiff
    Status `~/.julia/environments/v1/Project.toml`
  [163ba53b] DiffResults v0.0.4
  [f6369f11] ForwardDiff v0.10.3
  [276daf66] SpecialFunctions v0.7.2
  [90137ffa] StaticArrays v0.11.0 #master (https://github.com/JuliaArrays/StaticArrays.jl.git)
  [b77e0a4c] InteractiveUtils 
  [37e2e46d] LinearAlgebra 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions