Hi, I’m trying to concatenate an 2D generator that generate an 2D array of 2x2 arrays, such as this one
iter = (rand(2,2) for i in 1:d1, j in 1:d2 )
I would need to concatenate these arrays into a 2 by d1
by 2 by d2
array, ideally w/o first generating an array of wrong permutation and then permute. I tried cat(iter..., dims=(1,3))
or cat(iter..., dims=(2,4))
, neither worked.
I also read a little about this thread, however, I don’t want to collect(iter)
before the concatenation or use LazyArrays
as the latter is probably not as efficient when later used for LA operations. In other words, I want the memory to be allocated exactly as specified dimensions.
So what is the right way to generate this concatenation correctly?
Thank you!