Skip to content

Lazy broadcasting bug? #38

Open
Open
@mcabbott

Description

@mcabbott

I just ran into the following error:

julia> R = rand(3); s = 1;

julia> using LazyArrays: lazy

julia> @. lazy(2 * s * R)
3-element LazyArrays.BroadcastArray{Float64,1,Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Tuple{Base.OneTo{Int64}},typeof(*),Tuple{Int64,Int64,Array{Float64,1}}}}:
 0.9510075392608135 
 1.3657778460965129 
 0.34610423904646703

julia> @. lazy((2s) * R)
ERROR: MethodError: no method matching LazyArrays.BroadcastArray{Int64,N,BRD} where BRD<:Base.Broadcast.Broadcasted where N(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(*),Tuple{Int64,Int64}})

The same happens for @~ @. (2s) * R obviously.

This is for LazyArrays v0.8.1, Julia 1.1. On master, #31 has changed things such that I get the error only when calling LazyArray:

julia> @. lazy(2 * s * R)
Base.Broadcast.Broadcasted(*, (2, 1, [0.147668, 0.659113, 0.367685]))

julia> @. lazy((2s) * R)
Base.Broadcast.Broadcasted(*, (Base.Broadcast.Broadcasted(*, (2, 1)), [0.147668, 0.659113, 0.367685]))

julia> LazyArray(@. lazy(2 * s * R))
3-element BroadcastArray{Float64,1,Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Tuple{Base.OneTo{Int64}},typeof(*),Tuple{Int64,Int64,Array{Float64,1}}}}:
 0.29533639092844455
 1.318225163324581  
 0.7353707033373191 

julia> LazyArray(@. lazy((2s) * R))
ERROR: MethodError: no method matching BroadcastArray{Int64,N,BRD} where BRD<:Base.Broadcast.Broadcasted where N(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(*),Tuple{Int64,Int64}})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions