quspin.basis.bitwise_not
- quspin.basis.bitwise_not(x, out=None, where=None)
Bitwise NOT operation ~x.
Performs pair-wise bitwise NOT operation basis states in integer representation.
- Parameters:
- xarray-like
a collection of integers which contain basis states to apply pair-wise NOT on.
- outarray-like, optional
an array to hold the resulting ~x integer.
- where: array_like[bool], optional
an array of booleans (mask) to define which elements of x to apply the bitwise NOT operation on.
- Returns:
- numpy.ndarray
array of unsigned integers containing the result of the bitwise operation. Output is of same data type as x.
Examples
>>> from quspin.basis import spin_basis_general, basis_int_to_python_int >>> N=100 # sites >>> basis=spin_basis_general(N,Nup=1) # 1 particle >>> x=[basis.states[0]] # large integer stored as a byte >>> not_x=bitwise_not(x) >>> print('original integer stored as a byte:') >>> print(x) >>> x_int=basis_int_to_python_int(x) # cast byte as python integer >>> print('original integer in integer form:') >>> print(x_int) >>> print('result in integer form:') >>> print(basis_int_to_python_int(not_x))