quspin.basis.bitwise_rightshift

quspin.basis.bitwise_rightshift(x1, x2, out=None, where=None)

Bitwise RIGHT SHIFT operation x1 >> x2.

Performs pair-wise bitwise OR operation on pairs of basis states in integer representation.

Parameters:
x1array-like

a collection of integers which contain basis states to apply pair-wise RIGHT SHIFT on.

x2array-like

a collection of integers to apply pair-wise RIGHT SHIFT of x1 with.

outarray-like, optional

an array to hold the resulting x1 >> x2 integer.

where: array_like[bool], optional

an array of booleans (mask) to define which pairs of elements of (x1,x2) to apply the bitwise RIGHT SHIFT 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
>>> x1=[basis.states[0]] # large integer stored as a byte
>>> x2=[basis.states[1]] # large integer stored as a byte
>>> x1_rightshift_x2=bitwise_rightshift(x1,x2)
>>> print('x1 integer stored as a byte:')
>>> print(x1)
>>> x1_int=basis_int_to_python_int(x1) # cast byte as python integer
>>> print('x1 integer in integer form:')
>>> print(x1_int)
>>> print('result in integer form:')
>>> print(basis_int_to_python_int(x1_rightshift_x2))