Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointwise .== fails with arrays #216

Open
zenna opened this issue Jun 20, 2022 · 0 comments
Open

Pointwise .== fails with arrays #216

zenna opened this issue Jun 20, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@zenna
Copy link
Owner

zenna commented Jun 20, 2022

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

@zenna zenna added the bug Something isn't working label Jun 20, 2022
@zenna zenna added this to the 1.0 milestone Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant