JuliaSIMD / JuliaSIMD/LoopVectorization.jl

@turbo can't find index when looping over sparse arrays

Open
#485 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

I am trying to use turbo in this function to multiply `A'x` when A is sparse

```Julia
function my_mul_lv!(y::Vector{Float64}, A::SparseMatrixCSC{Float64,Int64}, x::Vector{Float64})
@turbo for i in eachindex(y)
tmp = 0.0
for j in nzrange(A, i)
tmp += A.nzval[j] * x[A.rowval[j]]
end
y[i] = tmp
end
return
end
```

The function works without the `@turbo` macro but when I add it, it throws this an error that `i` isn't defined: `UndefVarError: i not defined`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.