- nlcpy.invert = <ufunc 'nlcpy_invert'>
Computes the bit-wise NOT element-wise.
This ufunc implements the C/Python operator
Only integer and boolean types are handled. If
x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
- outndarray or None, optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
- wherearray_like, optional
This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default
out=None, locations within it where the condition is False will remain uninitialized.
For other keyword-only arguments, see the section Optional Keyword Arguments.
y = ~ x. If x is a scalar, this function returns the result as a 0-dimension ndarray.
>>> import nlcpy as vp >>> x = vp.invert(vp.array(13, dtype=vp.uint32)) >>> x array(4294967282, dtype=uint32)
When using signed integer types the result is the two's complement of the result for the unsigned type:
>>> vp.invert(vp.array(, dtype=vp.int32)) array([-14], dtype=int32)
Booleans are accepted as well:
>>> vp.invert(vp.array([True, False])) array([False, True])