page_type | languages | products | description | ||
---|---|---|---|---|---|
sample |
|
|
This sample implements Grover's search algorithm, an example of a quantum development technique known as amplitude amplification. |
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.
- The Microsoft Quantum Development Kit.
To run the sample, use the dotnet run
command from your terminal.
- SimpleGrover.qs: Q# code implementing quantum operations for this sample.
- Reflections.qs: Q# code implementing quantum operations for this sample.
- SimpleGroverSample.csproj: Main Q# project for the sample.