(x)
return np.prod(x.shape) - x.nnz
Count the number of implicit zeros in a sparse matrix.
Count the number of implicit zeros in a sparse matrix.
Count the number of implicit zeros in a sparse matrix .
def sparse_count_implicit_zeros(x):
    """ Count the number of implicit zeros in a sparse matrix. """
    if not sp.issparse(x):
        raise TypeError('The matrix provided was not sparse.')
    return np.prod(x.shape) - x.nnz
def sparse_count_implicit_zeros ( x ) : if not sp . issparse ( x ) : raise TypeError ( 'The matrix provided was not sparse.' ) return np . prod ( x . shape ) - x . nnz