Esempio n. 1
0
 def test_two_mode_squeezed_var(self):
     """Checking that the variance of samples matches if there was
     correlation."""
     mode1 = [0]
     mode2 = [1]
     samples = entangled_gaussian_samples()
     var1 = samples_variance(samples, mode1)
     var2 = samples_variance(samples, mode2)
     assert var1 == var2
Esempio n. 2
0
 def var(self, observable, wires, par):
     if observable == "Identity":
         return 0
     return samples_variance(self.samples, modes=self.map_wires(wires))
Esempio n. 3
0
 def test_fock_backend_integration_var(self, var, modes):
     """Checking the variance when fock states were sampled with a single shot."""
     samples = fock_states_samples()
     assert samples_variance(samples, modes) == var
Esempio n. 4
0
 def test_quadrature_variance(self, samples, var):
     """Checking the variance of pre-defined homodyne samples."""
     assert np.isclose(samples_variance(samples), var)
Esempio n. 5
0
 def test_fock_backend_integration_modes_implicit(self):
     """Checking the variance when modes are specified implicitly."""
     samples = fock_states_samples()
     var = 0
     assert samples_variance(samples) == var