Skip to content

Commit e5b2738

Browse files
committed
tests for the leaky_entanglement_fidelity function that Ive had for a while. The tests only consider when no leakage is modeled. New tests wil be needed for when theres a leakage dimension
1 parent c71c73f commit e5b2738

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit/tools/test_optools.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,19 @@ def test_entanglement_fidelity(self):
412412
self.assertAlmostEqual(fidelity_TP_unitary_jam, expect)
413413
self.assertAlmostEqual(fidelity_TP_unitary_std, expect)
414414

415+
def test_leaky_entanglement_fidelity(self):
416+
fidelity_TP_unitary= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
417+
fidelity_TP_unitary_no_flag= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
418+
fidelity_TP_unitary_jam= ot.leaky_entanglement_fidelity(self.A_TP, self.B_unitary, 'pp')
419+
fidelity_TP_unitary_std= ot.leaky_entanglement_fidelity(self.A_TP_std, self.B_unitary_std, mx_basis='std')
420+
421+
expect = 0.4804724656092404
422+
self.assertAlmostEqual(fidelity_TP_unitary, expect)
423+
self.assertAlmostEqual(fidelity_TP_unitary_no_flag, expect)
424+
self.assertAlmostEqual(fidelity_TP_unitary_jam, expect)
425+
self.assertAlmostEqual(fidelity_TP_unitary_std, expect)
426+
pass
427+
415428
def test_fidelity_upper_bound(self):
416429
np.random.seed(0)
417430
Q = np.linalg.qr(np.random.randn(4,4) + 1j*np.random.randn(4,4))[0]

0 commit comments

Comments
 (0)