Get the transpose of Vector{Vector{Float64}}

15et7dtwq
Wed, 16 Apr 2025 19:38:47 +0000
New to Julia

I am coming from numpy, trying tosee if Julia can be faster. Right now I am dealing with a function that generates for me what I thought had to be a matrix, but no, it’s a vector of vector. Fine. How do I make it’s transpose?

I generate the Vector{Vector} from list comprehension
tab = [ map( (x) -> d[1] + (d[2]-d[1] )*x , rand(Uniform(0,1),Np) ) for d in domains ]

For Np=2 and a 5D domain domains=( (100,1000), (-1,1), (-1,1), (-1,1), (-1,1) ) I get a

size(tab)=(5,)

I need to make it become a (5,2).

I have tried to use cat, but it’s not the right tool. transpose gives me a 1x5 and I cannot manipulate it to a 2D Matrix (2,5).

Any suggestion? Must be a common roadbloack for someone coming from numpy…

10 posts - 8 participants