@@ -30,21 +30,21 @@ def _count_nans_per_row_sparse(X, weights, dtype=None):
3030 return np .fromiter ((np .isnan (row .data ).sum () for row in X ), dtype = dtype )
3131
3232
33- def sparse_count_zeros (x ):
33+ def sparse_count_implicit_zeros (x ):
3434 """ Count the number of implicit zeros in a sparse matrix. """
3535 if not sp .issparse (x ):
3636 raise TypeError ('The matrix provided was not sparse.' )
3737 return np .prod (x .shape ) - x .nnz
3838
3939
40- def sparse_has_zeros (x ):
40+ def sparse_has_implicit_zeros (x ):
4141 """ Check if sparse matrix contains any implicit zeros. """
4242 if not sp .issparse (x ):
4343 raise TypeError ('The matrix provided was not sparse.' )
4444 return np .prod (x .shape ) != x .nnz
4545
4646
47- def sparse_zero_weights (x , weights ):
47+ def sparse_implicit_zero_weights (x , weights ):
4848 """ Extract the weight values of all zeros in a sparse matrix. """
4949 if not sp .issparse (x ):
5050 raise TypeError ('The matrix provided was not sparse.' )
@@ -103,10 +103,10 @@ def bincount(x, weights=None, max_val=None, minlength=None):
103103 if sp .issparse (x ):
104104 x = x .tocsr ()
105105 if weights is not None :
106- zero_weights = sparse_zero_weights (x , weights ).sum ()
106+ zero_weights = sparse_implicit_zero_weights (x , weights ).sum ()
107107 weights = weights [x .indices ]
108108 else :
109- zero_weights = sparse_count_zeros (x )
109+ zero_weights = sparse_count_implicit_zeros (x )
110110
111111 x = x .data
112112
@@ -343,7 +343,7 @@ def _nan_min_max(x, func, axis=0):
343343 return func (x , axis = axis )
344344 if axis is None :
345345 extreme = func (x .data , axis = axis ) if x .nnz else float ('nan' )
346- if sparse_has_zeros (x ):
346+ if sparse_has_implicit_zeros (x ):
347347 extreme = func ([0 , extreme ])
348348 return extreme
349349 if axis == 0 :
@@ -356,7 +356,7 @@ def _nan_min_max(x, func, axis=0):
356356 for row in x :
357357 values = row .data
358358 extreme = func (values ) if values .size else float ('nan' )
359- if sparse_has_zeros (row ):
359+ if sparse_has_implicit_zeros (row ):
360360 extreme = func ([0 , extreme ])
361361 r .append (extreme )
362362 return np .array (r )
@@ -422,7 +422,7 @@ def unique(x, return_counts=False):
422422 if not sp .issparse (x ):
423423 return np .unique (x , return_counts = return_counts )
424424
425- implicit_zeros = sparse_count_zeros (x )
425+ implicit_zeros = sparse_count_implicit_zeros (x )
426426 explicit_zeros = not np .all (x .data )
427427 r = np .unique (x .data , return_counts = return_counts )
428428 if not implicit_zeros :
0 commit comments