S = spalloc(m,n,nzmax)
S = spalloc(m,n,nzmax)
creates an all zero sparse matrix S
of size m
-by-n
with room to hold nzmax
nonzeros. The matrix can then be generated column by column without requiring repeated storage allocation as the number of nonzeros grows.
spalloc(m,n,nzmax)
is shorthand for
sparse([],[],[],m,n,nzmax)
S = spalloc(n,n,3*n);
for j = 1:n
S(:,j) = { the j-th column }
end
(c) Copyright 1994 by The MathWorks, Inc.