MATLAB Function Reference |
Syntax
n=
nnz(X)
Description
稀疏矩陣的密度為 nnz(X)/prod(size(X))
。
Examples
w = sparse(wilkinson(21));
三個對角線中每一條皆含有 20
非零元素,故 nnz(w) = 60
。
See Also
find
, isa
, nonzeros
, nzmax
, size
, whos
nnls | noanimate |