From 44532959b30a129a8c92f0043a9029401ae0579a Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Wed, 12 Jun 2024 15:52:30 +0400 Subject: [PATCH] fix --- src/qibo/quantum_info/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qibo/quantum_info/utils.py b/src/qibo/quantum_info/utils.py index e47382cfa0..b00838f1ea 100644 --- a/src/qibo/quantum_info/utils.py +++ b/src/qibo/quantum_info/utils.py @@ -105,11 +105,15 @@ def hamming_distance( bitstring_1 = "0" * (nbits - len(bitstring_1)) + bitstring_1 bitstring_2 = "0" * (nbits - len(bitstring_2)) + bitstring_2 - difference = np.abs( - np.array(list(bitstring_1), dtype=int) - np.array(list(bitstring_2), dtype=int) + difference = np.array(list(bitstring_1), dtype=int) - np.array( + list(bitstring_2), dtype=int ) + print(difference, difference.dtype) + difference = np.abs(difference) + difference = difference.astype(str) + difference = "".join(difference) - return hamming_weight(f"{difference:{nbits}b}", return_indexes=return_indexes) + return hamming_weight(difference, return_indexes=return_indexes) def hadamard_transform(array, implementation: str = "fast", backend=None):