コード例 #1
0
def dbs_circuit_test_():
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    p = np.zeros((2, 2))
    a = np.zeros(4)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        a = np.reshape(rpv, (2, 2))
        alpha, beta, gamma = bds_circuit_angles(a)
        psi = bds_circuit_(alpha, beta, gamma)
        rhor = ptr.pTraceL(4, 4, mf.proj(16, psi))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=0.75)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
コード例 #2
0
def dbs_rpv_test():
    from states import bell
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        rhor = rpv[0] * mf.proj(4, bell(0, 0)) + rpv[1] * mf.proj(
            4, bell(0, 1))
        rhor += (rpv[2] * mf.proj(4, bell(1, 0)) +
                 rpv[3] * mf.proj(4, bell(1, 1)))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=0.5)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
コード例 #3
0
def dbs_circuit_test():
    ns = 5 * 10**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    for j in range(0, ns):
        rpv = rpvg.rpv_zhsl(4)
        theta = 2.0 * math.acos(math.sqrt(rpv[0] + rpv[1]))
        alpha = 2.0 * math.acos(math.sqrt(rpv[0] + rpv[2]))
        psi = bds_circuit(theta, alpha)
        rhor = ptr.pTraceL(4, 4, mf.proj(16, psi))
        cm = gm.corr_mat(2, 2, rhor)
        cxx[j] = cm[0][0]
        cyy[j] = cm[1][1]
        czz[j] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=1)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()
コード例 #4
0
def steering(rho):  # arXiv:1510.08030
    import gell_mann as gm
    #    cm = np.zeros(3,3)
    cm = gm.corr_mat(2, 2, rho)
    W = np.zeros(3)
    # W = LA.eigvalsh(cm)
    u, W, vh = LA.svd(cm, full_matrices=True)
    return max(0,
               (sqrt((W[0]**2) + (W[1]**2) + (W[2]**2)) - 1) / (sqrt(3) - 1))
    '''
コード例 #5
0
def chsh(rho):  # arXiv:1510.08030
    import gell_mann as gm
    #    cm = np.zeros(3, 3)
    cm = gm.corr_mat(2, 2, rho)
    W = np.zeros(3)
    # W = LA.eigvalsh(cm)
    u, W, vh = LA.svd(cm, full_matrices=True)
    no = np.sqrt(2) - 1
    nl = (sqrt(W[0]**2 + W[1]**2 + W[2]**2 - min(W[0], W[1], W[2])**2) -
          1) / no
    return max(0, nl)
コード例 #6
0
def hellinger(da, db, rho):  # arXiv:1510.06995
    daa = da**2 - 1
    M = mat_sqrt(da * db, rho)
    A = pTraceR(da, db, M)
    bva = gm.bloch_vector(da, A) / sqrt(2 * db)
    B = pTraceL(da, db, M)
    bvb = gm.bloch_vector(db, B) / 2
    cm = gm.corr_mat(da, db, M) / 2
    ev = np.zeros(3)
    ev = LA.eigvalsh(
        outerr(daa, bva, bva) + np.matmul(cm, transpose(3, 3, cm)))
    mev = max(ev[0], ev[1], ev[2])
    bvbn = normr(2, bvb)
    nor = 1 - 1 / sqrt(da)
    return max(
        0, (1 - sqrt((trace(da, A) / sqrt(2 * db))**2 + bvbn**2 + mev)) / nor)
コード例 #7
0
def dbs_circuit_test_angles_():
    ns = 20**3
    cxx = np.zeros(ns)
    cyy = np.zeros(ns)
    czz = np.zeros(ns)
    m = -1
    da = math.pi / 20
    alpha = -math.pi / 2 - da
    for j in range(0, 20):
        alpha += da
        beta = -da
        for k in range(0, 20):
            beta += da
            gamma = -da
            for l in range(0, 20):
                gamma += da
                psi = bds_circuit_(alpha, beta, gamma)
                rhor = ptr.pTraceL(4, 4, mf.proj(16, psi))
                cm = gm.corr_mat(2, 2, rhor)
                m += 1
                cxx[m] = cm[0][0]
                cyy[m] = cm[1][1]
                czz[m] = cm[2][2]
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(cxx, cyy, czz, c='b', marker='o', s=0.75)
    ax.set_xlabel('c_xx')
    ax.set_ylabel('c_yy')
    ax.set_zlabel('c_zz')
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
    ax.set_zlim(-1, 1)
    ax.plot([-1, 1], [-1, 1], [-1, -1], color='b')
    ax.plot([-1, 1], [1, -1], [1, 1], color='b')
    ax.plot([-1, 1], [-1, -1], [-1, 1], color='b')
    ax.plot([-1, -1], [-1, 1], [-1, 1], color='b')
    ax.plot([1, -1], [1, 1], [-1, 1], color='b')
    ax.plot([1, 1], [1, -1], [-1, 1], color='b')
    plt.show()