-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
Julia Version: 1.1.0
rand(10) returns a 10-element Array{Float64, 1}.
rand.(10) returns the same thing, but of course with different numbers.
rand(10) .< 0.3 works, returning a 10-element BitArray{1}.
rand.(10) .< 0.3 screams:
julia> rand.(10) .< 0.3
ERROR: MethodError: no method matching isless(::Array{Float64,1}, ::Float64)
Closest candidates are:
isless(::Float64, ::Float64) at float.jl:459
isless(::Missing, ::Any) at missing.jl:70
isless(::AbstractFloat, ::AbstractFloat) at operators.jl:148
...
Stacktrace:
[1] <(::Array{Float64,1}, ::Float64) at .\operators.jl:260
[2] _broadcast_getindex at .\broadcast.jl:578 [inlined]
[3] getindex at .\broadcast.jl:511 [inlined]
[4] copy at .\broadcast.jl:763 [inlined]
[5] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(<),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(rand),Tuple{Int64}},Float64}}) at .\broadcast.jl:753
[6] top-level scope at none:0It doesn't seem right.
I encountered the issue on a more complex line, where I had been using @. at the beginning for convenience. It also does not work like that either.
Metadata
Metadata
Assignees
Labels
No labels