page_type | languages | products | description | ||
---|---|---|---|---|---|
sample |
|
|
This sample shows how to use synthesis techniques to implement arbitrary quantum oracles in Q#. |
This sample shows the implementation of an arbitrary quantum oracle function using Hadamard gates, CNOT gates, and arbitrary Z-rotations. The algorithm is based on papers by N. Schuch and J. Siewert [Programmable networks for quantum algorithms, Phys. Rev. Lett. 91, 027902, 2003] and J. Welch, D. Greenbaum, S. Mostame, and A. Aspuru-Guzik [Efficient quantum circuits for diagonal unitaries without ancillas, New J. of Phys. 16, 033040, 2014].
This sample describes in detail the underlying concepts that were used to implement the following operations from the Q# Standard library:
- Microsoft.Quantum.Canon.ApplyAnd
- Microsoft.Quantum.Synthesis.ApplyXControlledOnTruthTable
- Microsoft.Quantum.Synthesis.ApplyXControlledOnTruthTableWithCleanTarget
- The Microsoft Quantum Development Kit.
To run the sample, use the dotnet run
command from your terminal.
- OracleSynthesis.csproj: Main Q# project for the example.
- OracleSynthesis.qs: The Q# implementation for oracle synthesis.
- Program.qs: The Q# program entry point for the example.