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

Latest commit

 

History

History
47 lines (33 loc) · 2.69 KB

File metadata and controls

47 lines (33 loc) · 2.69 KB
page_type languages products description
sample
qsharp
qdk
This sample implements Grover's search algorithm, an example of a quantum development technique known as amplitude amplification.

Searching with Grover's Algorithm

This sample implements Grover's search algorithm, an example of a quantum development technique known as amplitude amplification. Oracles implementing the database are explicitly constructed together with all steps of the algorithm. See the DatabaseSearch sample for and extended version and the Grover Search Kata to learn more about Grover's algorithm and how to implement it in Q#.

This sample uses the example of an operation that marks inputs of the form "010101…", then uses Grover's algorithm to find these inputs given only the ability to call that operation. In this case, the sample uses a hard-coded operation, but operations and functions in the Microsoft.Quantum.AmplitudeAmplification namespace can be used to efficiently and easily construct different inputs to Grover's algorithm, and to quickly build up useful variations of amplitude amplification for different applications. For examples of how to solve more general problems using amplitude amplification, check out the more in-depth database search sample.

Prerequisites

Running the Sample

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

Q# in Visual Studio Code or the Command Line

At a terminal, run the following command:

dotnet run

Q# in Visual Studio 2019

Open the folder containing this sample in Visual Studio ("Open a local folder" from the Getting Started screen or "File → Open → Folder..." from the menu bar) and set SimpleGroverSample.csproj as the startup project. Press Start in Visual Studio to run the sample.

Manifest