def test_outcome_probabilities_cntrl(self): for _ in range(100): qc = QC(4, 0, probabilistic=True) qc.create_bell_pair(0, 1) qc.CZ(0, 2) outcome = qc.measure([1, 0]) self.assertEqual(outcome[0], outcome[1])
def test_outcome_probabilities_CZ(self): for _ in range(100): qc = QC(4, 0, probabilistic=True) qc.create_bell_pair(0, 1) qc.CZ(1, 0) outcome = qc.measure([1, 0]) self.assertFalse(outcome[0] == outcome[1])
def test_outcome_probabilities_single_selection(self): for _ in range(100): qc = QC(4, 0, probabilistic=True) qc.create_bell_pair(3, 1) qc.create_bell_pair(2, 0) qc.CZ(0, 1) qc.CZ(2, 3) outcome = qc.measure([0, 2]) self.assertEqual(outcome[0], outcome[1])
def test_outcome_probabilities_single_dot(self): for _ in range(100): qc = QC(6, 0, probabilistic=True) qc.create_bell_pair(5, 2) qc.create_bell_pair(4, 1) qc.single_selection(CNOT_gate, 3, 0) qc.single_selection(CZ_gate, 3, 0) qc.CZ(4, 5) qc.CZ(1, 2) outcomes = qc.measure([1, 4]) self.assertEqual(outcomes[0], outcomes[1]) bell_matrix = 1 / 2 * np.array([[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]]) np.testing.assert_array_equal( qc._qubit_density_matrix_lookup[5][0].toarray(), bell_matrix)