This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

nzmax

Amount of storage allocated for nonzero matrix elements

Syntax

n = nzmax(S)

Description

n = nzmax(S) returns the amount of storage allocated for nonzero elements in sparse matrix S. For sparse matrices, nzmax(S) >= 1.

  • If S is a full matrix, then nzmax(S) is equal to prod(size(S)).

Often, nnz(S) and nzmax(S) are the same. But if S is created by an operation which produces fill-in matrix elements, such as sparse matrix multiplication or sparse LU factorization, then more storage might be allocated than is actually required, and nzmax(S) reflects this. Alternatively, sparse(i,j,s,m,n,nzmax) or its simpler form, spalloc(m,n,nzmax), can set nzmax in anticipation of later fill-in.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

| | | | |

Introduced before R2006a