MCPcopy Create free account
hub / github.com/numpy/numpy / bitwise_and

Function bitwise_and

numpy/array_api/_elementwise_functions.py:131–145  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.bitwise_and `. See its docstring for more information.

(x1: Array, x2: Array, /)

Source from the content-addressed store, hash-verified

129
130
131def 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

Callers 3

__and__Method · 0.85
__rand__Method · 0.85
__iand__Method · 0.85

Calls 3

_result_typeFunction · 0.85
_normalize_two_argsMethod · 0.80
_newMethod · 0.80

Tested by

no test coverage detected