Skip to content

Commit

Permalink
tests for the leaky_entanglement_fidelity function that Ive had for a…
Browse files Browse the repository at this point in the history
… while. The tests only consider when no leakage is modeled. New tests wil be needed for when theres a leakage dimension
  • Loading branch information
rileyjmurray committed Sep 24, 2024
1 parent c71c73f commit e5b2738
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/unit/tools/test_optools.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,19 @@ def test_entanglement_fidelity(self):
self.assertAlmostEqual(fidelity_TP_unitary_jam, expect)
self.assertAlmostEqual(fidelity_TP_unitary_std, expect)

def test_leaky_entanglement_fidelity(self):
fidelity_TP_unitary= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
fidelity_TP_unitary_no_flag= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
fidelity_TP_unitary_jam= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
fidelity_TP_unitary_std= ot.leaky_entanglement_fidelity(self.A_TP_std, self.B_unitary_std, mx_basis='std')

expect = 0.4804724656092404
self.assertAlmostEqual(fidelity_TP_unitary, expect)
self.assertAlmostEqual(fidelity_TP_unitary_no_flag, expect)
self.assertAlmostEqual(fidelity_TP_unitary_jam, expect)
self.assertAlmostEqual(fidelity_TP_unitary_std, expect)
pass

def test_fidelity_upper_bound(self):
np.random.seed(0)
Q = np.linalg.qr(np.random.randn(4,4) + 1j*np.random.randn(4,4))[0]
Expand Down

0 comments on commit e5b2738

Please sign in to comment.