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

Latest commit

 

History

History

reversible-simulator-simple

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
page_type languages products description
sample
qsharp
csharp
qdk
This sample implements a simple reversible simulator for Q# using the `IQuantumProcessor` interface.

A simple reversible simulator

This samples shows how to build a simple reversible simulator. It is very similar to the existing Toffoli simulator, but presented as an example of how to use the IQuantumProcessor interface. A reversible simulator can simulate quantum programs that consist only of classical operations: X, CNOT, CCNOT (Toffoli gate), or arbitrarily controlled X operations. Since a reversible simulator can represent the quantum state by assigning one Boolean value to each qubit, it can run even quantum programs that consist of thousands of qubits. This simulator is very useful for testing quantum operations that evaluate Boolean functions.

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:

dotnet run

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

Manifest

  • Operation.qs: Q# code implementing quantum operations for this sample.
  • Simulator.cs: C# implementation of a reversible simulator using the IQuantumProcessor interface.
  • Driver.cs: C# code running the quantum operations with the reversible simulator.
  • ReversibleSimulator.csproj: C# project for the sample.