From ab05a834a7bada680e58331bc78ced18b5c77002 Mon Sep 17 00:00:00 2001 From: Yuan YAO Date: Mon, 13 May 2024 16:45:01 -0400 Subject: [PATCH] fix the bug in thermal loss for gaussian backend --- strawberryfields/backends/gaussianbackend/gaussiancircuit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strawberryfields/backends/gaussianbackend/gaussiancircuit.py b/strawberryfields/backends/gaussianbackend/gaussiancircuit.py index 73e767e34..083f47140 100644 --- a/strawberryfields/backends/gaussianbackend/gaussiancircuit.py +++ b/strawberryfields/backends/gaussianbackend/gaussiancircuit.py @@ -439,7 +439,7 @@ def thermal_loss(self, T, nbar, k): raise ValueError("Cannot apply loss channel, mode does not exist") self.loss(T, k) - self.nmat += (1 - T) * nbar + self.nmat[k, k] += (1 - T) * nbar def init_thermal(self, population, mode): """Initializes a state of mode in a thermal state with the given population"""