Grover's search algorithm.
Last active
October 15, 2021 07:22
-
-
Save guenp/5a6f16fce0fc0a552df30bd46f528e05 to your computer and use it in GitHub Desktop.
Grover's algorithm: Large circuit with repeating blocks
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
{ | |
"qubits": [ | |
{ | |
"id": 0, | |
"numChildren": 1 | |
}, | |
{ | |
"id": 1, | |
"numChildren": 1 | |
}, | |
{ | |
"id": 2, | |
"numChildren": 1 | |
}, | |
{ | |
"id": 3, | |
"numChildren": 1 | |
}, | |
{ | |
"id": 4 | |
} | |
], | |
"operations": [ | |
{ | |
"gate": "GroverSearch", | |
"children": [ | |
{ | |
"gate": "PrepareSuperposition", | |
"children": [ | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "GroverIteration", | |
"displayArgs": "(Oracle)", | |
"children": [ | |
{ | |
"gate": "Oracle", | |
"displayArgs": "(Oracle_6)", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Oracle_6", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Diffuser", | |
"children": [ | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "ConditionalPhaseFlip", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "Z", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "R", | |
"displayArgs": "(PauliI, 3.141592653589793)", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "GroverIteration", | |
"displayArgs": "(Oracle)", | |
"children": [ | |
{ | |
"gate": "Oracle", | |
"displayArgs": "(Oracle_6)", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Oracle_6", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Diffuser", | |
"children": [ | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "ConditionalPhaseFlip", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "Z", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "R", | |
"displayArgs": "(PauliI, 3.141592653589793)", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "GroverIteration", | |
"displayArgs": "(Oracle)", | |
"children": [ | |
{ | |
"gate": "Oracle", | |
"displayArgs": "(Oracle_6)", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Oracle_6", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 4 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "Diffuser", | |
"children": [ | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "ConditionalPhaseFlip", | |
"children": [ | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "Z", | |
"isControlled": true, | |
"controls": [ | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "R", | |
"displayArgs": "(PauliI, 3.141592653589793)", | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "X", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 3 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 2 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 1 | |
} | |
] | |
}, | |
{ | |
"gate": "H", | |
"isAdjoint": true, | |
"targets": [ | |
{ | |
"qId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
}, | |
{ | |
"gate": "M", | |
"isMeasurement": true, | |
"controls": [ | |
{ | |
"qId": 0 | |
} | |
], | |
"targets": [ | |
{ | |
"type": 1, | |
"qId": 0, | |
"cId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "M", | |
"isMeasurement": true, | |
"controls": [ | |
{ | |
"qId": 1 | |
} | |
], | |
"targets": [ | |
{ | |
"type": 1, | |
"qId": 1, | |
"cId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "M", | |
"isMeasurement": true, | |
"controls": [ | |
{ | |
"qId": 2 | |
} | |
], | |
"targets": [ | |
{ | |
"type": 1, | |
"qId": 2, | |
"cId": 0 | |
} | |
] | |
}, | |
{ | |
"gate": "M", | |
"isMeasurement": true, | |
"controls": [ | |
{ | |
"qId": 3 | |
} | |
], | |
"targets": [ | |
{ | |
"type": 1, | |
"qId": 3, | |
"cId": 0 | |
} | |
] | |
} | |
], | |
"targets": [ | |
{ | |
"qId": 0 | |
}, | |
{ | |
"qId": 1 | |
}, | |
{ | |
"qId": 2 | |
}, | |
{ | |
"qId": 3 | |
}, | |
{ | |
"qId": 4 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment