Hi,

Suppose I want to fill the columns of a matrix which size I don't know 
beforehand:

A = zeros(3,0)
for i=1:n
  A = [A [1,2,3]]
end

Is there a memory efficient way of doing that in Julia?

I understand that the above syntax is allocating 3*i entries at iteration i 
which gives 3*(1+2+...+n) = 3*(n+1)n/2 allocations as opposed to 3n.

-Júlio

Reply via email to