| 1 |
# |
| 2 |
# File: test13.qasm |
| 3 |
# Date: 22-Mar-04 |
| 4 |
# Author: I. Chuang <[email protected]> |
| 5 |
# |
| 6 |
# Sample qasm input file - three-qubit phase |
| 7 |
# estimation circuit with QFT and controlled-U |
| 8 |
|
| 9 |
defbox CU,3,1,'U' |
| 10 |
defbox CU2,3,1,'U^2' |
| 11 |
defbox CU4,3,1,'U^4' |
| 12 |
def c-S,1,'S' |
| 13 |
def c-T,1,'T' |
| 14 |
|
| 15 |
qubit j0,0 # QFT qubits |
| 16 |
qubit j1,0 |
| 17 |
qubit j2,0 |
| 18 |
qubit s0 # U qubits |
| 19 |
qubit s1 |
| 20 |
|
| 21 |
h j0 # equal superposition |
| 22 |
h j1 |
| 23 |
h j2 |
| 24 |
|
| 25 |
CU4 j0,s0,s1 # controlled-U |
| 26 |
CU2 j1,s0,s1 |
| 27 |
CU j2,s0,s1 |
| 28 |
|
| 29 |
h j0 # QFT |
| 30 |
c-S j0,j1 |
| 31 |
h j1 |
| 32 |
nop j0 |
| 33 |
c-T j0,j2 |
| 34 |
c-S j1,j2 |
| 35 |
h j2 |
| 36 |
nop j0 |
| 37 |
nop j0 |
| 38 |
nop j1 |
| 39 |
|
| 40 |
measure j0 # final measurement |
| 41 |
measure j1 |
| 42 |
measure j2 |