Running Grover's algorithm as an Aqua function
At the end of Chapter 9, Grover's Search Algorithm, we promised that there was an easier way to include Grover's search algorithm in your quantum circuits. In this recipe, we will achieve the same results, but without having to build the circuit from scratch; Qiskit Aqua will set up the oracle, build the Grover circuit, and run it for us.
Just like importing and calling Python classes and methods for various things, such as from math import pi
to get access to a numerical representation of , you can do the same with Qiskit® components. Why reinvent the wheel and build your implementation of the Grover search algorithm when it is already included with Qiskit®?
Getting ready
The sample code for this recipe can be found here: https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience/blob/master/Chapter10/ch10_r1_grover_aqua.py.
Before we jump in, let&apos...