Skip to content

isneginf

Test element-wise for negative infinity, return result as sparse bool array.

Parameters:

Name Type Description Default
x

Input

required
out

Output array

None
optional

Output array

None

Examples:

>>> import sparse
>>> x = sparse.as_coo(np.array([-np.inf]))
>>> sparse.isneginf(x).todense()
array([ True])
See Also

numpy.isneginf : The NumPy equivalent

Source code in sparse/numba_backend/_coo/common.py
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
def isneginf(x, out=None):
    """
    Test element-wise for negative infinity, return result as sparse `bool` array.

    Parameters
    ----------
    x
        Input
    out, optional
        Output array

    Examples
    --------
    >>> import sparse
    >>> x = sparse.as_coo(np.array([-np.inf]))
    >>> sparse.isneginf(x).todense()
    array([ True])

    See Also
    --------
    [`numpy.isneginf`][] : The NumPy equivalent
    """
    from sparse import elemwise

    return elemwise(lambda x, out=None, dtype=None: np.isneginf(x, out=out), x, out=out)