What's actually the difference between the following commands
sparse(zeros(10000));sparse([],[],[],10000,10000,0);a = sparse([]); for i =1:10000,for j = 1:10000, a(i,j) = 0,end,end
Oftentimes the first line leads to out-of-memory problem while the rest do not when the dimension acretes.
I consulted to some tutorial about memory allocation that says "loop" is at times useful to speed up and avoid memory outflow.
When should I use loop to generate a really "big" matrix? or the second line just dominates?
Thanks
Best Answer