Skip to content

Pointwise .== fails with arrays #216

Description

@zenna
julia> x = manynth(Normal(0, 1), [1,2,3])
Mv{Vector{Int64}, Normal{Float64}}([1, 2, 3], Normal{Float64}(μ=0.0, σ=1.0))

julia> randsample(x)
3-element Vector{Float64}:
  0.5329609997818248
  0.6091868691905119
 -1.1231586242100318

julia> x .== [3,4,5]
ERROR: MethodError: no method matching size(::Mv{Vector{Int64}, Normal{Float64}})
Closest candidates are:
  size(::Union{LinearAlgebra.Adjoint{T, var"#s859"}, LinearAlgebra.Transpose{T, var"#s859"}} where {T, var"#s859"<:(AbstractVector)}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/adjtrans.jl:172
  size(::Union{LinearAlgebra.Adjoint{T, var"#s859"}, LinearAlgebra.Transpose{T, var"#s859"}} where {T, var"#s859"<:(AbstractMatrix)}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/adjtrans.jl:173
  size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/qr.jl:567
  ...
Stacktrace:
 [1] axes
   @ ./abstractarray.jl:95 [inlined]
 [2] combine_axes
   @ ./broadcast.jl:499 [inlined]
 [3] instantiate
   @ ./broadcast.jl:281 [inlined]
 [4] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.Unknown, Nothing, typeof(==), Tuple{Mv{Vector{Int64}, Normal{Float64}}, Vector{Int64}}})
   @ Base.Broadcast ./broadcast.jl:860
 [5] top-level scope
   @ REPL[29]:1

The issue is that the array is hijacking the broadcasting behavior

Activity

  1. added this to the 1.0 milestone on Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions