mxGetNzmax (C and Fortran)
Number of elements in IR, PR, and PI arrays
C Syntax
#include "matrix.h" mwSize mxGetNzmax(const mxArray *pm);
Fortran Syntax
#include "fintrf.h" mwSize mxGetNzmax(pm) mwPointer pm
Arguments
-
pm
-
Pointer to a sparse
mxArray
Returns
Number of elements allocated to hold nonzero entries in the specified sparsemxArray
, on success. Returns an indeterminate value on error. The most likely cause of failure is thatpm
points to a full (nonsparse)mxArray
.
Description
UsemxGetNzmax
to get the value of thenzmax
field. Thenzmax
field holds an integer value that signifies the number of elements in their
,公关
, and, if it exists, thepi
arrays. The value ofnzmax
is always greater than or equal to the number of nonzero elements in a sparsemxArray
. In addition, the value ofnzmax
is always less than or equal to the number of rows times the number of columns.
As you adjust the number of nonzero elements in a sparsemxArray
, MATLAB®software often adjusts the value of thenzmax
field. MATLAB adjustsnzmax
to reduce the number of costly reallocations and to optimize its use of heap space.