JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Support vectorizing `rand`?

Open
#281 4 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 have no idea if it is possible to vectorize `rand`.

I hope for a usage like below:

```julia
julia> using LoopVectorization

julia> m = zeros(Float32, 4,4)
4×4 Matrix{Float32}:
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0

julia> a = rand(Float32, 4,4)
4×4 Matrix{Float32}:
0.251334 0.409923 0.591477 0.04535
0.4116 0.52253 0.34138 0.870923
0.24401 0.116969 0.583924 0.0549548
0.528378 0.898528 0.519574 0.172627

julia> b = rand(Float32, 4,4)
4×4 Matrix{Float32}:
0.874233 0.263186 0.000970364 0.411874
0.0680491 0.951124 0.803958 0.197752
0.669292 0.996646 0.0915098 0.652465
0.395592 0.875268 0.601194 0.518282

julia> @avxt for i in eachindex(m)
m[i] = rand(a[i]:1.0f3:b[i])
end
```

I have tried `VectorizedRNG` but I did not find out how to set boundries.

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.