Open
Description
array_api_extra.cov
currently crashes in sparse on the edge case of size zero arrays.
>>> a = sparse.zeros((1, 0))
>>> a
<COO: shape=(1, 0), dtype=float64, nnz=0, fill_value=0.0>
>>> b = a - sparse.mean(a, axis=1)
site-packages/sparse/numba_backend/_umath.py:529: RuntimeWarning: invalid value encountered in divide
fill_value_array = self.func(*zero_args, dtype=self.dtype, **self.kwargs)
>>> b
<COO: shape=(1, 0), dtype=float64, nnz=0, fill_value=nan>
>>> b @ b.T
ValueError: This operation requires zero fill values, but argument 0 had a fill value of nan.
Expected results
fill_value
should not be considered in matmul
of an array with size 0.
Please describe your system.
sparse 0.17.0