|MATLAB Function Reference|
Convert sparse matrix to full matrix
A = full(S)
converts a sparse matrix
S to full storage organization. If
S is a full matrix, it is left unchanged. If
A is full,
X be an
n matrix with
nnz(X) nonzero entries. Then
full(X) requires space to store
m*n real numbers while
sparse(X) requires space to store
nz real numbers and
On most computers, a real number requires twice as much storage as an integer. On such computers,
sparse(X) requires less storage than
full(X) if the density,
nnz/prod(size(X)), is less than one third. Operations on sparse matrices, however, require more execution time per element than those on full matrices, so density should be considerably less than two-thirds before sparse storage is used.
Here is an example of a sparse matrix with a density of about two-thirds.
full(S) require about the same number of bytes of storage.
© 1994-2005 The MathWorks, Inc.