Exemplo n.º 1
0
def test_qcb_for_mixed_states():
    # both states are real so no need to conjugate
    theta = np.pi / 2
    G = np.array([[np.cos(theta), -np.sin(theta)],
                  [np.sin(theta), np.cos(theta)]])
    r = 0.9
    lam_p = r
    lam_m = 1 - lam_p
    rho = np.diag([lam_p, lam_m])
    rho_theta = np.matmul(np.matmul(G, rho), G.transpose())
    qcb, s = dm.quantum_chernoff_bound(rho, rho_theta)
    assert np.allclose(
        dm.quantum_chernoff_bound(rho, rho_theta)[0], 0.59999999999)
Exemplo n.º 2
0
def test_qcb_for_pure_states():
    # both states are real so no need to conjugate
    zero = np.array([[1], [0]])
    rho = np.matmul(zero, zero.transpose())
    theta = np.pi / 2
    psi_theta = np.array([[np.cos(theta / 2)], [np.sin(theta / 2)]])
    sigma = np.matmul(psi_theta, psi_theta.transpose())
    assert np.allclose(dm.quantum_chernoff_bound(rho, sigma)[0], 0.5000000000)