isinf
Tests each element x_i of the input array x to determine if equal to positive or negative infinity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
input array of a numeric data type. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
array
|
an array containing test results. The returned array has a data type of |
Special Cases
For real-valued floating-point operands,
- If
x_iis either+infinityor-infinity, the result isTrue. - In the remaining cases, the result is
False.
For complex floating-point operands, let a = real(x_i), b = imag(x_i), and
- If
ais either+infinityor-infinityandbis any value (includingNaN), the result isTrue. - If
ais either a finite number orNaNandbis either+infinityor-infinity, the result isTrue. - In the remaining cases, the result is
False.
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0, 1], [2, np.inf]]))
>>> o = sparse.isinf(a)
>>> o.todense()
array([[False, False],
[False, True]])
Source code in sparse/numba_backend/_common.py
2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 | |