From 39fe4bfcb2ba50266d18a3228e48a56510d86709 Mon Sep 17 00:00:00 2001 From: Yuan YAO Date: Tue, 14 May 2024 14:01:18 -0400 Subject: [PATCH] change the purity calculation for gaussian state --- strawberryfields/backends/states.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strawberryfields/backends/states.py b/strawberryfields/backends/states.py index 184532909..fce20fd74 100644 --- a/strawberryfields/backends/states.py +++ b/strawberryfields/backends/states.py @@ -1010,8 +1010,8 @@ def __init__(self, state_data, num_modes, mode_names=None): self._alpha /= np.sqrt(2 * self._hbar) self._pure = ( - np.abs(np.linalg.det(self._cov) - (self._hbar / 2) ** (2 * self._modes)) - < self.EQ_TOLERANCE + np.abs(np.linalg.det(self._cov)) / (self._hbar / 2) ** (2 * self._modes) + == 1.0 ) self._basis = "gaussian"