def makeLambda_mk(U_k, m, rho_f): n = len(U_k) # Product of U_k_n ... U_k_m+1 U = U_k[n - 1] for j in range(n-2, m-1, -1): U = np.dot(U, U_k[j]) return np.dot(np.dot(U.conj().T, rho_f), U)
def fidSingleTxFull(rho_0, rho_f, T, N, Us): U_k_ts = [np.array(U_k(T), np.complex128) for U_k in Us] mats = [ np.dot(np.dot(rho_f.conj().T, U_k_t), np.dot(rho_0, U_k_t.conj().T)) for U_k_t in U_k_ts ] terms = [np.trace(mat) for mat in mats] return (1. / N) * sum(terms)
def G(t_): if profiling: start = time.time() hp = H_p(a, eta_k, t_) teatime = time.time() th_time[0] += teatime - start res = np.dot(cvec, hp) g_time[0] += time.time() - teatime return res return np.dot(cvec, H_t2(a(t_), eta_k(t_)))
def BCH(A, B, order=4): start = time.time() c1 = np.dot(k1,comm(A, B)) c2 = np.dot(k2,comm(A, c1)) c3 = np.dot(k3,comm(B, c1)) res = A + B + c1 + c2 + c3 if order > 3: c4 = np.dot(k4,comm(B, c2)) res += c4 if order > 4: c5 = np.dot(k5,(bch5(A, B) + bch5(B, A))) res += c5 if profiling: bch_time[0] += time.time() - start return res
def makeTerm(k): # U_k = Us_mk[k] # Us_nm_k = U_k[m:(n-1)] # # Us_nm_k.reverse() # Us_m1_k = U_k[0:(m-1)] # # Us_m1_k.reverse() # # U_nm_k = reduce(np.dot, reversed(Us_nm_k),identity) # U_nm_kH = U_nm_k.conj().T # U_m1_k = reduce(np.dot, reversed(Us_m1_k),identity) # U_m1_kH = U_m1_k.conj().T # # lambda_mk = reduce(np.dot, [U_nm_kH, rho_f, U_nm_k]) # lambda_H = lambda_mk.conj().T # rho_mk = reduce(np.dot, [U_m1_k, rho_0, U_m1_kH]) U_k = Us_mk[k] lambda_mk = makeLambda_mk(U_k, m, rho_f) lambda_H = lambda_mk.conj().T rho_mk = makeRho_mk(U_k, m, rho_0) term = np.trace(np.dot(lambda_H, comm(sigmaX, rho_mk))) return term
def fidSingleTxDirect(rho_f, rho, T): return np.trace(np.dot(rho_f.conj().T, rho(T)))
def comm(A, B): return np.dot(A, B) - np.dot(B, A)
def R(U_k): U = np.array(U_k(t)) return np.dot(np.dot(U, rho_0), U.conj().T)
def makeRho_mk(U_k, m, rho_0): # Product of U_k_m ... U_k_1 U = U_k[m - 1] for j in range(m-2, -1, -1): U = np.dot(U, U_k[j]) return np.dot(np.dot(U, rho_0), U.conj().T)