Created
June 23, 2022 12:27
-
-
Save frankzickert/87a25b41ac2d44973852840e6952aec5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def oracle(secret, as_gate=True): | |
o_qc = QuantumCircuit(DIGITS+1) | |
for i in range(DIGITS): | |
if secret[::-1][i] == '1': | |
o_qc.cx(i,DIGITS) | |
else: | |
o_qc.i(i) | |
return o_qc.to_gate(label="oracle") if as_gate else o_qc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment