Manuscript En02-E@2 · En02-E-v2.tex · section · c2769986
Unexecuted reproducibility supplement
Unexecuted reproducibility supplement · lines 1947–2019
def encoder(odd): U = np.eye(8,dtype=complex) sequence = [(CZ,(1,2)),(CZ,(0,1)),(SD,(2,)),(H,(2,)), (SD,(0,)),(H,(0,)),(CX,(0,1)),(CX,(2,1)),(Y,(1,))] for G,p in sequence: U = embed(G,p,3)@U J = np.zeros((32,2),complex) for m,a,b in it.product(range(2),repeat=3): J[integer((a,m,b,a,b)),m] = .5 V = kron(U.conj().T,np.eye(4))@J return embed(CZ,(0,1),5)@V if odd else V
def dilation(V,a,t): dk = list(it.product(range(3),repeat=t)) ek = [(0,b) for b in it.product(range(2),repeat=5)] ek += [(1,b) for b in it.product(range(2),repeat=5-t)] di,ei = d:i for i,d in enumerate(dk),e:i for i,e in enumerate(ek) A = np.zeros((len(dk),len(ek),2),complex) for b in it.product(range(2),repeat=5): row = V[integer(b)] A[di[(0,)*t],ei[0,b]] += np.sqrt(1-a)*row d = tuple(z+1 for z in b[:t]) A[di[d],ei[1,b[t:]]] += np.sqrt(a)*row return A,dk,ek
def channel(A): return (i,j):A[:,:,i]@A[:,:,j].conj().T for i,j,E in units()
def decoupling(A): E = (i,j):A[:,:,i].T@A[:,:,j].conj() for i,j,U in units() bell = np.block([[E[0,0],E[0,1]],[E[1,0],E[1,1]]])/2 marginal = (E[0,0]+E[1,1])/2 return float(np.sum(np.abs(np.linalg.eigvalsh( herm(bell-kron(I/2,marginal)))))/2)
def decoder_kraus(dk,odd=False,low=False): """Complete decoder on all 27 physical input configurations.""" occupied = [dk.index(tuple(z+1 for z in b)) for b in it.product(range(2),repeat=3)] E = np.eye(len(dk),dtype=complex)[occupied,:] ops = [] if low: for t,s,u in it.product(range(2),repeat=3): row = kron(I[:,t].conj()[None,:], H[:,s].conj()[None,:], I[:,u].conj()[None,:]) sign = -(-1)**(t+s+u) out = np.array([[1],[sign]],complex)/np.sqrt(2) ops.append(out@row@E) else: B12 = kron(H,I)@kron(SD,I)@CX@kron(I,H) early = B12@(CZ if odd else np.eye(4)) for t,s in it.product(range(2),repeat=2): correction = np.linalg.matrix_power(X,1-t)@np.linalg.matrix_power(Z,1-s) ops.append(correction@H@SD@kron(early[2*t+s][None,:],I)@E) for j in range(len(dk)): if j not in occupied: for bit in range(2): ops.append(I[:,bit:bit+1]@np.eye(len(dk))[j:j+1,:]/np.sqrt(2)) return ops
def kraus_archive(ops,name): o,d = ops[0].shape R = sum(np.outer(A.reshape(-1),A.reshape(-1).conj()) for A in ops) completeness = sum(A.conj().T@A for A in ops) save(name,Kraus=np.array(ops),Choi=R) jwrite(name+"_basis","Kraus_axes":["path","output","input"], "Choi_axes":"output then input", "output_dimension":o,"input_dimension":d) accept(name,"Choi":R,"Kraus_completeness":completeness-np.eye(d), "Choi_TP":ptout(R,o,d)-np.eye(d),TOL)
Nearby in this section
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement
- section: Unexecuted reproducibility supplement