dpnp.bitwise_not¶
- dpnp.bitwise_not = <DPNPUnaryFunc 'invert'>¶
Inverts (flips) each bit for each element \(x_i\) of the input array x.
Note that
dpnp.bitwise_invertis an alias ofdpnp.invert.For full documentation refer to
numpy.invert.- Parameters:
- x{dpnp.ndarray, usm_ndarray}
Input array, expected to have an integer or boolean data type.
- out{None, dpnp.ndarray, usm_ndarray, tuple of ndarray}, optional
Output array to populate. Array must have the correct shape and the expected data type. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
Default:
None.- order{None, "C", "F", "A", "K"}, optional
Memory layout of the newly output array, if parameter out is
None.Default:
"K".
- Returns:
- outdpnp.ndarray
An array containing the element-wise results. The data type of the returned array is same as the data type of the input array.
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedErrorexception will be raised.See also
dpnp.bitwise_andCompute the bit-wise AND of two arrays element-wise.
dpnp.bitwise_orCompute the bit-wise OR of two arrays element-wise.
dpnp.bitwise_xorCompute the bit-wise XOR of two arrays element-wise.
dpnp.logical_notCompute the truth value of NOT x element-wise.
dpnp.binary_reprReturn the binary representation of the input number as a string.
Examples
>>> import dpnp as np
The number 13 is represented by
00001101. The invert or bit-wise NOT of 13 is then:>>> x = np.array([13]) >>> np.invert(x) array([-14]) >>> np.binary_repr(-14, width=8) '11110010'
>>> a = np.array([True, False]) >>> np.invert(a) array([False, True])
The
~operator can be used as a shorthand forinvertondpnp.ndarray.>>> ~a array([False, True])