Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Latest commit

 

History

History

database-search

page_type languages products description jupyter
sample
qsharp
qdk
This sample shows how to use Q# to search for a marked item with Grover's algorithm.
jupytext kernelspec
cell_markers text_representation
region,endregion
extension format_name format_version jupytext_version
.md
markdown
1.2
1.5.2
display_name language name
.NET (PowerShell)
PowerShell
.net-powershell

Database Search Sample

This sample walks through Grover's search algorithm. Oracles implementing the database are explicitly constructed together with all steps of the algorithm.

This sample features three examples:

  1. A search made without any Grover iterations, equivalent to a random classical search.
  2. A quantum search using manually implemented Grover iterations to amplify the marked element.
  3. A quantum search using operations from the Q# standard library to amplify multiple marked elements.

Prerequisites

Running the Sample

This sample can be run in a number of different ways, depending on your preferred environment.

Visual Studio Code or the Command Line

At a terminal, run the following commands for each of the three examples.

Example 1

dotnet run simulate Microsoft.Quantum.Samples.DatabaseSearch.RunRandomSearch

Example 2

dotnet run simulate Microsoft.Quantum.Samples.DatabaseSearch.RunQuantumSearch

Example 3

dotnet run simulate Microsoft.Quantum.Samples.DatabaseSearch.RunMultipleQuantumSearch

Running the Sample in Jupyter Notebook

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

Manifest