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
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
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)