Skip to content

Support ranges #23

@MasonProtter

Description

@MasonProtter
using LoopVectorization
function f(a)
    s = 0.0
    @avx for i in eachindex(a)
        s += a[i]
    end
    s
end

julia> f([1,2,3]) 
6.0

julia> f(1:3)
 StackOverflowError:
 Stacktrace:
  [1] stridedpointer(::UnitRange{Int64}) at /Users/mason/.julia/packages/VectorizationBase/yJngh/src/vectorizable.jl:389 (repeats 80000 times)

I think this should be supportable. One (dumb) way to make this work would just be

VectorizationBase.stridedpointer(r::AbstractRange) = VectorizationBase.stridedpointer(collect(r))

but I wonder if there's a way we can do it that doesn't require explicitly materializing the range. Maybe this issue should be moved to VectorizationBase though,

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