Skip to content

isposinf

Test element-wise for positive 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.isposinf(x).todense()
array([ True])
See Also

numpy.isposinf : The NumPy equivalent

Source code in sparse/numba_backend/_coo/common.py
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
def isposinf(x, out=None):
    """
    Test element-wise for positive 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.isposinf(x).todense()
    array([ True])

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

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