I am trying to do a vmap
on a function. map
and ThreadsX.map
both work.
collatz(x::Int64) =
if iseven(x)
x Γ· 2
else
3x + 1
end
function collatz_sequencia(x::Int64)
n = 0
while true
x == 1 && return n
n += 1
x = collatz(x)
end
return n
end
Then:
vmap(collatz_sequencia, 1:10)
MethodError: no method matching zero_offsets(::VectorizationBase.FastRange{Int64, Static.StaticInt{0}, Static.StaticInt{1}, Int64})
Closest candidates are:
zero_offsets(!Matched::Static.StaticInt{N}) where N at /home/storopoli/.julia/packages/VectorizationBase/geEQH/src/static.jl:130
zero_offsets(!Matched::VectorizationBase.StridedPointer{T, N, C, B, R, X, O} where {X, O}) where {T, N, C, B, R} at /home/storopoli/.julia/packages/VectorizationBase/geEQH/src/strided_pointers/stridedpointers.jl:115
I tried to remove the range, but to no avail:
vmap(collatz_sequencia, collect(1:10))
MethodError: no method matching collatz_sequencia(::VectorizationBase.Vec{4, Int64})
Closest candidates are:
collatz_sequencia(!Matched::Int64) at /home/storopoli/Documents/Julia/Computacao-Cientifica/notebooks/3_Parallel.jl#==#a7be2174-a7dd-4259-aab9-64cdcc749fb0:1