From fa2db4960f6aaf5e1e508af24c29c36ac37a2b70 Mon Sep 17 00:00:00 2001 From: Davide Bincoletto Date: Wed, 11 Dec 2024 13:53:03 +0100 Subject: [PATCH] minor edit --- src/tequila/wavefunction/qubit_wavefunction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tequila/wavefunction/qubit_wavefunction.py b/src/tequila/wavefunction/qubit_wavefunction.py index ce40f3a4..82d6e67d 100644 --- a/src/tequila/wavefunction/qubit_wavefunction.py +++ b/src/tequila/wavefunction/qubit_wavefunction.py @@ -365,7 +365,7 @@ def normalize(self, inplace: bool = False) -> QubitWaveFunction: # because the __mul__ implementation of the number tries to perform some sort of array # operation. def length(self): - return sum(1 for _ in self.raw_items()) + return sum(1 for (k, v) in self.raw_items() if abs(v) > 1e-6) def __repr__(self): result = str()