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
def var(self, observable, wires, par): if observable == "Identity": return 0 return samples_variance(self.samples, modes=self.map_wires(wires))
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
def test_quadrature_variance(self, samples, var): """Checking the variance of pre-defined homodyne samples.""" assert np.isclose(samples_variance(samples), var)
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