From 522c7b9e0c82fe18b6f6514d974bc2a1f3a577a0 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Fri, 1 Dec 2023 15:41:33 +0400 Subject: [PATCH] fix bug --- src/qibo/quantum_info/random_ensembles.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qibo/quantum_info/random_ensembles.py b/src/qibo/quantum_info/random_ensembles.py index 8c9d4f8379..9ef63a653d 100644 --- a/src/qibo/quantum_info/random_ensembles.py +++ b/src/qibo/quantum_info/random_ensembles.py @@ -1159,11 +1159,13 @@ def _sample_from_quantum_mallows_distribution(nqubits: int, local_state): """ mute_index = list(range(nqubits)) - exponents = np.arange(nqubits, 0, -1, dtype=int) + exponents = np.arange(nqubits, 0, -1, dtype=np.int64) + powers = 4**exponents + powers[powers == 0] = np.iinfo(np.int64).max r = local_state.uniform(0, 1, size=nqubits) - indexes = -1 * (np.ceil(np.log2(r + (1 - r) / 4**exponents))) + indexes = -1 * (np.ceil(np.log2(r + (1 - r) / powers))) hadamards = 1 * (indexes < exponents)