GCXS.density

property GCXS.density

The ratio of nonzero to all elements in this array.

Returns:

The ratio of nonzero to all elements.

Return type:

float

See also

COO.size

Number of elements.

COO.nnz

Number of nonzero elements.

Examples

>>> import numpy as np
>>> from sparse import COO
>>> x = np.zeros((8, 8))
>>> x[0, :] = 1
>>> s = COO.from_numpy(x)
>>> s.density
0.125