qailab.utils#

Utility functions

Summary#

Functions:

distribution_to_array

Changes the distribution into the one dimensional array with size 2^n of respective values for each permutation.

number_to_bit_tuple

Changes number to tuple of bits.

Reference#

qailab.utils.number_to_bit_tuple(number: int, size: int) tuple[int, ...][source]#

Changes number to tuple of bits.

Parameters:

number (int) – number

Returns:

tuple with bits

Return type:

tuple[int]

qailab.utils.distribution_to_array(distribution: dict[tuple[int, ...], float]) ndarray[source]#

Changes the distribution into the one dimensional array with size 2^n of respective values for each permutation.

Parameters:

distribution (dict[tuple[int, ...], float]) – the distribution in given format.

Returns:

one dimensional array of given distribution.

Return type:

np.ndarray