I would like to initiate a Tuple of Vectors. I usually use map in this case as the return type is often of type Tuple, but for some reason the following MWE outputs a Vector of Vector instead of a Tuple of Vectors:
function initvec(T, sz)
return Vector{T}(undef, sz)
end
function tuplevecs(T, inner, outer)
return map(iter -> initvec(T, inner), 1:outer)
end
initvec(Float64, 10) #Vector{Float}
tupvec = tuplevecs(Float64, 10, 100) #Vector{Vector{Float64}}
typeof(tupvec) #Vector{Vector{Float64}}
I can manually change the type via Tuple(tupvec), but that seems inefficient.
Question: Is there a way to initialize a Tuple of Vectors via map? It does not really have to be map based either if there is another clever way to do what I intend to do.