Skip to content

Commit

Permalink
Merge pull request #1439 from qiboteam/fix-shor-example
Browse files Browse the repository at this point in the history
Fix Shor example
  • Loading branch information
MatteoRobbiati authored Sep 13, 2024
2 parents e93ec84 + c645237 commit a55d05f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/shor/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ def quantum_order_finding_semiclassical(N, a):
circuit.add(gates.U1(q_reg, -angle))
circuit.add(gates.H(q_reg))
results.append(circuit.add(gates.M(q_reg, collapse=True)))
circuit.add(gates.M(q_reg))

circuit() # execute
circuit(nshots=1) # execute
s = sum(int(r.symbols[0].outcome()) * (2**i) for i, r in enumerate(results))
print(f"The quantum circuit measures s = {s}.\n")
return s
Expand Down

0 comments on commit a55d05f

Please sign in to comment.