def test_ppt_distinguishability_yyd_states_no_probs(self): """ PPT distinguishing the YYD states from [1] should yield 7/8 ~ 0.875 If no probability vector is explicitly given, assume uniform probabilities are given. References: [1]: Yu, Nengkun, Runyao Duan, and Mingsheng Ying. "Four locally indistinguishable ququad-ququad orthogonal maximally entangled states." Physical review letters 109.2 (2012): 020506. https://arxiv.org/abs/1107.3224 """ psi_0 = bell(0) psi_1 = bell(2) psi_2 = bell(3) psi_3 = bell(1) x_1 = np.kron(psi_0, psi_0) x_2 = np.kron(psi_1, psi_3) x_3 = np.kron(psi_2, psi_3) x_4 = np.kron(psi_3, psi_3) rho_1 = x_1 * x_1.conj().T rho_2 = x_2 * x_2.conj().T rho_3 = x_3 * x_3.conj().T rho_4 = x_4 * x_4.conj().T states = [rho_1, rho_2, rho_3, rho_4] res = ppt_distinguishability(states) self.assertEqual(np.isclose(res, 7 / 8), True)
def test_schmidt_rank_bell_state(self): """ Computing the Schmidt rank of the entangled Bell state should yield a value greater than 1. """ rho = bell(0).conj().T * bell(0) self.assertEqual(schmidt_rank(rho) > 1, True)
def test_invalid_state_exclusion_probs(self): """Invalid probability vector.""" with self.assertRaises(ValueError): rho1 = bell(0) * bell(0).conj().T rho2 = bell(1) * bell(1).conj().T states = [rho1, rho2] conclusive_state_exclusion(states, [1, 2, 3])
def test_state_discrimination_one_state(self): """State discrimination for single state.""" rho = bell(0) * bell(0).conj().T states = [rho] res = state_discrimination(states) self.assertEqual(np.isclose(res, 1), True)
def test_invalid_unambiguous_state_exclusion_probs(self): """Invalid probability vector for unambiguous state exclusion.""" with self.assertRaises(ValueError): mat1 = bell(0) * bell(0).conj().T mat2 = bell(1) * bell(1).conj().T states = [mat1, mat2] unambiguous_state_exclusion(states, [1, 2, 3])
def test_unambiguous_state_exclusion_one_state(self): """Unambiguous state exclusion for single state.""" mat = bell(0) * bell(0).conj().T states = [mat] res = unambiguous_state_exclusion(states) self.assertEqual(np.isclose(res, 0), True)
def test_ppt_distinguishability_yyd_vectors(self): """ PPT distinguishing the YYD states from [1] should yield `7/8 ~ 0.875` Feeding the input to the function as state vectors. References: [1]: Yu, Nengkun, Runyao Duan, and Mingsheng Ying. "Four locally indistinguishable ququad-ququad orthogonal maximally entangled states." Physical review letters 109.2 (2012): 020506. https://arxiv.org/abs/1107.3224 """ psi_0 = bell(0) psi_1 = bell(2) psi_2 = bell(3) psi_3 = bell(1) x_1 = np.kron(psi_0, psi_0) x_2 = np.kron(psi_1, psi_3) x_3 = np.kron(psi_2, psi_3) x_4 = np.kron(psi_3, psi_3) states = [x_1, x_2, x_3, x_4] probs = [1 / 4, 1 / 4, 1 / 4, 1 / 4] res = ppt_distinguishability(states, probs) self.assertEqual(np.isclose(res, 7 / 8), True)
def test_bell_state_pt(self): """Test partial transpose on a Bell state.""" rho = bell(2) * bell(2).conj().T expected_res = np.array([[0, 0, 0, 1 / 2], [0, 1 / 2, 0, 0], [0, 0, 1 / 2, 0], [1 / 2, 0, 0, 0]]) res = partial_transpose(rho) self.assertEqual(np.allclose(res, expected_res), True)
def test_state_exclusion_one_state(self): """State exclusion for single state.""" rho = bell(0) * bell(0).conj().T states = [rho] res = conclusive_state_exclusion(states) self.assertEqual(np.isclose(res, 1), True)
def test_invalid_ppt_distinguishability_probs(self): """Invalid probability vector.""" with self.assertRaises(ValueError): rho1 = bell(0) * bell(0).conj().T rho2 = bell(1) * bell(1).conj().T states = [rho1, rho2] ppt_distinguishability(states, [1, 2, 3])
def test_pure_to_mixed_density_matrix(self): """Convert pure state to mixed state density matrix.""" expected_res = np.array([[1 / 2, 0, 0, 1 / 2], [0, 0, 0, 0], [0, 0, 0, 0], [1 / 2, 0, 0, 1 / 2]]) phi = bell(0) * bell(0).conj().T res = pure_to_mixed(phi) bool_mat = np.isclose(res, expected_res) self.assertEqual(np.all(bool_mat), True)
def test_state_exclusion_three_state_vec(self): """State exclusion for three Bell state vectors.""" rho1 = bell(0) rho2 = bell(1) rho3 = bell(2) states = [rho1, rho2, rho3] probs = [1 / 3, 1 / 3, 1 / 3] res = conclusive_state_exclusion(states, probs) self.assertEqual(np.isclose(res, 0), True)
def test_unambiguous_state_exclusion_three_state_vec(self): """Unambiguous state exclusion for three Bell state vectors.""" mat1 = bell(0) mat2 = bell(1) mat3 = bell(2) states = [mat1, mat2, mat3] probs = [1 / 3, 1 / 3, 1 / 3] res = unambiguous_state_exclusion(states, probs) self.assertEqual(np.isclose(res, 0), True)
def test_gen_bell_1_1_2(self): """Generalized Bell state for k_1 = 1, k_2 = 1 and dim = 2.""" dim = 2 k_1 = 1 k_2 = 1 expected_res = bell(3) * bell(3).conj().T res = gen_bell(k_1, k_2, dim) bool_mat = np.isclose(res, expected_res) self.assertEqual(np.all(bool_mat), True)
def test_state_discrimination_one_state_vec(self): """State discrimination for single vector state.""" rho = bell(0) states = [rho] res = state_discrimination(states) self.assertEqual(np.isclose(res, 1), True)
def test_unambiguous_state_exclusion_one_state_vec(self): """Unambiguous state exclusion for single vector state.""" vec = bell(0) states = [vec] res = unambiguous_state_exclusion(states) self.assertEqual(np.isclose(res, 0), True)
def test_bell_3(self): """Generates the Bell state: `1/sqrt(2) * (|01> - |10>)`.""" e_0, e_1 = ket(2, 0), ket(2, 1) expected_res = 1 / np.sqrt(2) * (np.kron(e_0, e_1) - np.kron(e_1, e_0)) res = bell(3) bool_mat = np.isclose(res, expected_res) self.assertEqual(np.all(bool_mat), True)
def test_pure_to_mixed_state_vector(self): """Convert pure state to mixed state vector.""" expected_res = np.array([[1 / 2, 0, 0, 1 / 2], [0, 0, 0, 0], [0, 0, 0, 0], [1 / 2, 0, 0, 1 / 2]]) phi = bell(0) res = pure_to_mixed(phi) bool_mat = np.isclose(res, expected_res) self.assertEqual(np.all(bool_mat), True)
def test_state_exclusion_three_state(self): """State exclusion for three Bell state density matrices.""" rho1 = bell(0) * bell(0).conj().T rho2 = bell(1) * bell(1).conj().T rho3 = bell(2) * bell(2).conj().T states = [rho1, rho2, rho3] probs = [1 / 3, 1 / 3, 1 / 3] res = conclusive_state_exclusion(states, probs) self.assertEqual(np.isclose(res, 0), True)
def test_unambiguous_state_exclusion_three_state(self): """Unambiguous state exclusion for three Bell state density matrices.""" mat1 = bell(0) * bell(0).conj().T mat2 = bell(1) * bell(1).conj().T mat3 = bell(2) * bell(2).conj().T states = [mat1, mat2, mat3] probs = [1 / 3, 1 / 3, 1 / 3] res = unambiguous_state_exclusion(states, probs) self.assertEqual(np.isclose(res, 0), True)
def test_is_pure_state(self): """Ensure that pure Bell state returns True.""" rho = bell(0) * bell(0).conj().T self.assertEqual(is_pure(rho), True)
def test_bell_invalid(self): """Ensures that an integer above 3 is error-checked.""" with self.assertRaises(ValueError): bell(4)
def test_entangled_state(self): """Entangled state of dimension 2 will violate PPT criterion.""" rho = bell(2) * bell(2).conj().T self.assertEqual(is_ppt(rho), False)