sparseness(x, ...), where $n$ is the length of $x$.
The sparseness is a real number in $[0,1]$. It is
equal to 1 if and only if x contains a single
nonzero component, and is equal to 0 if and only if all
components of x are equal. It interpolates
smoothly between these two extreme values. The closer to
1 is the sparseness the sparser is the vector.
The basic definition is for a numeric vector, and
is extended for matrices as the mean sparseness of its
column vectors.
entropy, purity