quspin.basis.python_int_to_basis_int

quspin.basis.python_int_to_basis_int(python_int, dtype=None)

Converts python integer to QuSpin basis type.

This function takes a python integer and converts it to a basis type either specified by the user via the dtype argument or the minium type which will fit that integer.

Parameters:
python_int: int

integer to be converted

dtype: dtype, optional

data type used to represent the python integer: uint32, uint64, uint256, uint1024, uint4096, uint16384. or numpy.object

Returns:
numpy scalar object

the appropriate converted value which can be assigned to a numpy array.

Examples

>>> new_val = python_int_to_basis_int(val,dtype=uint256)
>>> new_val = python_int_to_basis_int(val)