Skip to content

Latest commit

 

History

History
 
 

qpic-simulator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
page_type languages products description
sample
qsharp
csharp
qdk
This sample uses `IQuantumProcessor` to generate quantum circuit diagrams from execution traces.

Generating quantum circuit diagrams from execution traces

This sample illustrates how IQuantumProcessor can be used to generate quantum circuit diagrams from Q# program execution traces, using the ⟨q|pic⟩ language. It makes uses of custom intrinsic operations and classical control transformations.

Prerequisites

Running the Sample

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

C# in Visual Studio Code or the Command Line

At a terminal, run the following command (with example arguments for the inputs) in the host directory:

dotnet test

After running the tests, the directory bin/Debug/netcoreapp3.1 contains ⟨q|pic⟩ circuit diagrams for the test cases. You can create picture files from them using the following commands (assuming that ⟨q|pic⟩ is installed):

cp bin/Debug/netcoreapp3.1/t-injection.qpic .
qpic -f png t-injection.qpic

The resulting file will look as follows:

T injection circuit diagram

C# 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 host/host.csproj as the startup project. Press Start in Visual Studio to run the sample.

Manifest