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

Latest commit

 

History

History
64 lines (46 loc) · 3.08 KB

README.md

File metadata and controls

64 lines (46 loc) · 3.08 KB
page_type author description ms.author ms.date languages products
sample
cgranade
Search unstructured data on quantum hardware, using the Azure Quantum service
01/25/2021
qsharp
qdk
azure-quantum

Simple Grover's search with the Azure Quantum service

This sample demonstrates how to use Q# and the Azure Quantum service together to search for data with Grover's algorithm, also known as amplitude amplification. By applying a sequence of reflections, this state prepares a register of qubits in a state marked by a given quantum operation known as an oracle. The oracle used in this sample checks if its input matches a given integer, so that the computational basis state corresponding to that index is prepared with high probability.

This sample is implemented as a standalone executable, such that no C# or Python host is needed. The program takes one command-line option, --n-qubits, to control the number of qubits that are prepared using amplitude amplification.

Q# standalone command-line

Running the sample on a local simulator

dotnet run -- --simulator QuantumSimulator --n-qubits=3 --idx-marked=6

Running the sample on the Azure Quantum service

Make sure that you have created and selected a quantum workspace, and then run the following at the command line, substituting TARGET with the target that you would like to run against (e.g.: ionq.qpu or quantinuum.qpu.h1):

az quantum execute --target-id TARGET -- --n-qubits=3 --idx-marked=6

For a full list of available quantum computing targets, run:

az quantum target list --output table

⚠️ This sample makes use of paid services on Azure Quantum. The cost of running this sample with the provided parameters on IonQ in a Pay-As-You-Go subscription is approximately $6 USD (or the equivalent amount in your local currency). This quantity is only an approximate estimate and should not be used as a binding reference. The cost of the service might vary depending on your region, demand and other factors.

Q# with Jupyter Notebook

Make sure that you have followed the Q# + Jupyter Notebook quickstart for the Quantum Development Kit, and then start a new Jupyter Notebook session from the folder containing this sample:

cd grover
jupyter notebook

Once Jupyter starts, open the Grover.ipynb notebook and follow the instructions there.

Manifest