Test element-wise for positive infinity, return result as bool array. Parameters ---------- x : array_like The input array. out : array_like, optional A location into which the result is stored. If provided, it must have a shape that the input broadcasts
(x, out=None)
| 70 | |
| 71 | @array_function_dispatch(_dispatcher, verify=False, module='numpy') |
| 72 | def isposinf(x, out=None): |
| 73 | """ |
| 74 | Test element-wise for positive infinity, return result as bool array. |
| 75 | |
| 76 | Parameters |
| 77 | ---------- |
| 78 | x : array_like |
| 79 | The input array. |
| 80 | out : array_like, optional |
| 81 | A location into which the result is stored. If provided, it must have a |
| 82 | shape that the input broadcasts to. If not provided or None, a |
| 83 | freshly-allocated boolean array is returned. |
| 84 | |
| 85 | Returns |
| 86 | ------- |
| 87 | out : ndarray |
| 88 | A boolean array with the same dimensions as the input. |
| 89 | If second argument is not supplied then a boolean array is returned |
| 90 | with values True where the corresponding element of the input is |
| 91 | positive infinity and values False where the element of the input is |
| 92 | not positive infinity. |
| 93 | |
| 94 | If a second argument is supplied the result is stored there. If the |
| 95 | type of that array is a numeric type the result is represented as zeros |
| 96 | and ones, if the type is boolean then as False and True. |
| 97 | The return value `out` is then a reference to that array. |
| 98 | |
| 99 | See Also |
| 100 | -------- |
| 101 | isinf, isneginf, isfinite, isnan |
| 102 | |
| 103 | Notes |
| 104 | ----- |
| 105 | NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic |
| 106 | (IEEE 754). |
| 107 | |
| 108 | Errors result if the second argument is also supplied when x is a scalar |
| 109 | input, if first and second arguments have different shapes, or if the |
| 110 | first argument has complex values |
| 111 | |
| 112 | Examples |
| 113 | -------- |
| 114 | >>> np.isposinf(np.PINF) |
| 115 | True |
| 116 | >>> np.isposinf(np.inf) |
| 117 | True |
| 118 | >>> np.isposinf(np.NINF) |
| 119 | False |
| 120 | >>> np.isposinf([-np.inf, 0., np.inf]) |
| 121 | array([False, False, True]) |
| 122 | |
| 123 | >>> x = np.array([-np.inf, 0., np.inf]) |
| 124 | >>> y = np.array([2, 2, 2]) |
| 125 | >>> np.isposinf(x, y) |
| 126 | array([0, 0, 1]) |
| 127 | >>> y |
| 128 | array([0, 0, 1]) |
| 129 |
no outgoing calls