-- https://arxiv.org/abs/2408.11606 -- Find X and Y such that X + Y = 5 -- 13 qubits psi = zero(2^13) -- ground state psi[1] = 1 -- qubit names (reverse bit order for X and Y) X2 = 0 X1 = 1 X0 = 2 Y2 = 3 Y1 = 4 Y0 = 5 A0 = 6 A1 = 7 S0 = 8 S1 = 9 S2 = 10 S3 = 11 Q12 = 12 -- init psi = rotate(psi, H,X0, H,X1, H,X2) psi = rotate(psi, H,Y0, H,Y1, H,Y2) psi = rotate(psi, X,Q12, H,Q12) for(k,1,2, -- QuantumAdder psi = rotate(psi, C,X2, X,S3), psi = rotate(psi, C,Y2, X,S3), psi = rotate(psi, C,X2, C,Y2, X,A0), psi = rotate(psi, C,X1, X,S2), psi = rotate(psi, C,Y1, X,S2), psi = rotate(psi, C,X1, C,Y1, X,A1), psi = rotate(psi, C,A0, X,S2), psi = rotate(psi, C,X1, C,A0, X,A1), psi = rotate(psi, C,Y1, C,A0, X,A1), psi = rotate(psi, C,X0, X,S1), psi = rotate(psi, C,Y0, X,S1), psi = rotate(psi, C,X0, C,Y0, X,S0), psi = rotate(psi, C,A1, X,S1), psi = rotate(psi, C,X0, C,A1, X,S0), psi = rotate(psi, C,Y0, C,A1, X,S0), -- Query psi = rotate(psi, X,S0, X,S2), psi = rotate(psi, C,S0, C,S1, C,S2, C,S3, X,Q12), psi = rotate(psi, X,S0, X,S2), -- Inverse QuantumAdder psi = rotate(psi, C,Y0, C,A1, X,S0), psi = rotate(psi, C,X0, C,A1, X,S0), psi = rotate(psi, C,A1, X,S1), psi = rotate(psi, C,X0, C,Y0, X,S0), psi = rotate(psi, C,Y0, X,S1), psi = rotate(psi, C,X0, X,S1), psi = rotate(psi, C,Y1, C,A0, X,A1), psi = rotate(psi, C,X1, C,A0, X,A1), psi = rotate(psi, C,A0, X,S2), psi = rotate(psi, C,X1, C,Y1, X,A1), psi = rotate(psi, C,Y1, X,S2), psi = rotate(psi, C,X1, X,S2), psi = rotate(psi, C,X2, C,Y2, X,A0), psi = rotate(psi, C,Y2, X,S3), psi = rotate(psi, C,X2, X,S3), -- Diffuser psi = rotate(psi, H,X0, H,X1, H,X2), psi = rotate(psi, H,Y0, H,Y1, H,Y2), psi = rotate(psi, X,X0, X,X1, X,X2), psi = rotate(psi, X,Y0, X,Y1, X,Y2), psi = rotate(psi, C,X0, C,X1, C,X2, C,Y0, C,Y1, C,Y2, X,Q12), psi = rotate(psi, X,X0, X,X1, X,X2), psi = rotate(psi, X,Y0, X,Y1, X,Y2), psi = rotate(psi, H,X0, H,X1, H,X2), psi = rotate(psi, H,Y0, H,Y1, H,Y2) ) -- probability P = psi conj(psi) -- sum over 7 don't care bits (2^7 = 128) for(j,1,64, for(k,1,127, P[j] = P[j] + P[j + 64 k])) -- draw graph "Probability vs. eigenstate" xrange = (0,64) yrange = (0,0.2) draw(P[ceiling(x)],x) "Probability of observing Y=0, X=5" P[5 + 1] -- add 1 because index numbering starts at 1 "Probability of observing Y=1, X=4" P[8 * 1 + 4 + 1] "Probability of observing Y=2, X=3" P[8 * 2 + 3 + 1] "Probability of observing Y=3, X=2" P[8 * 3 + 2 + 1] "Probability of observing Y=4, X=1" P[8 * 4 + 1 + 1] "Probability of observing Y=5, X=0" P[8 * 5 + 1]
Run