Array API compatible wrapper for :py:func:`np.bitwise_and `. See its docstring for more information.
(x1: Array, x2: Array, /)
| 129 | |
| 130 | |
| 131 | def bitwise_and(x1: Array, x2: Array, /) -> Array: |
| 132 | """ |
| 133 | Array API compatible wrapper for :py:func:`np.bitwise_and <numpy.bitwise_and>`. |
| 134 | |
| 135 | See its docstring for more information. |
| 136 | """ |
| 137 | if ( |
| 138 | x1.dtype not in _integer_or_boolean_dtypes |
| 139 | or x2.dtype not in _integer_or_boolean_dtypes |
| 140 | ): |
| 141 | raise TypeError("Only integer or boolean dtypes are allowed in bitwise_and") |
| 142 | # Call result type here just to raise on disallowed type combinations |
| 143 | _result_type(x1.dtype, x2.dtype) |
| 144 | x1, x2 = Array._normalize_two_args(x1, x2) |
| 145 | return Array._new(np.bitwise_and(x1._array, x2._array)) |
| 146 | |
| 147 | |
| 148 | # Note: the function name is different here |
no test coverage detected