page_type | languages | products | description | jupyter | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
This sample shows how to use Q# to search for a marked item with Grover's algorithm. |
|
This sample walks through Grover's search algorithm. Oracles implementing the database are explicitly constructed together with all steps of the algorithm. This features two examples -- the first implements the steps of Grover's algorithm manually. The second applies amplitude amplification functions in the canon to automate many steps of the implementation.
- The Microsoft Quantum Development Kit.
This sample can be run in a number of different ways, depending on your preferred environment.
At a terminal, run the following command:
python host.py
At a terminal, run the following command:
dotnet run
This sample can also be viewed using Jupyter Notebook. To do so, ensure that you have the IQ# kernel installed using the instructions in the getting started guide. Then, start a new Jupyter Notebook session from this directory:
cd Samples/src/DatabaseSearch
jupyter notebook
- DatabaseSearch.qs: Q# code implementing quantum operations for this sample.
- Program.cs: C# code to interact with and print out results of the Q# operations for this sample.
- DatabaseSearchSample.csproj: Main C# project for the sample.
- Database Search.ipynb: The sample as a Jupyter Notebook.