Qubit.NET 1.0.1

dotnet add package Qubit.NET --version 1.0.1
                    
NuGet\Install-Package Qubit.NET -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Qubit.NET" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Qubit.NET" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Qubit.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Qubit.NET --version 1.0.1
                    
#r "nuget: Qubit.NET, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Qubit.NET@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Qubit.NET&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Qubit.NET&version=1.0.1
                    
Install as a Cake Tool

Qubit.NET

A quantum computing simulator for .NET — and the only one that runs in Unity.

Build quantum circuits, apply gates, measure results, draw circuit diagrams, and export to OpenQASM so your circuit runs on real hardware. No dependencies.

dotnet add package Qubit.NET

Targets .NET Standard 2.0 / 2.1, .NET 8 and .NET 10 — so it also runs on .NET Framework 4.6.1+, Mono and Godot.


Quick start

using Qubit.NET;

var qc = new QuantumCircuit(2);

qc.H(0);          // superposition
qc.CNOT(0, 1);    // entangle

Console.WriteLine(qc);           // 0.7071|00> + 0.7071|11>
Console.WriteLine(qc.Measure()); // "00" or "11", never "01" or "10"

Run it many times and count outcomes:

using Qubit.NET.Simulation;

qc.Measure();
var result = Simulator.Run(qc, 1000)[0];

Console.WriteLine(result);                   // {'00': 512, '11': 488}
Console.WriteLine(result.Probability("11")); // 0.488

Draw circuits

qc.Draw();               // colored, to the console
qc.ToDiagram();          // the same thing as a string
q2 (0): ───────────[+]──[X]──[M]─
                    |    |    |
q1 (0): ──────[+]───@────|───[M]─
               |    |    |    |
q0 (0): ─[H]───@────@───[X]──[M]─

Unity

Qubit.NET ships a netstandard2.1 build, so it works in Unity 2021.2+. Install through NuGetForUnity, or drop lib/netstandard2.1/Qubit.NET.dll into Assets/Plugins/.

Unity has no Console, so use the string-returning APIs:

Debug.Log(qc.ToDiagram());

var (x, y, z) = qc.BlochVector(0);   // drive a Bloch sphere gizmo
arrow.transform.localPosition = new Vector3((float)x, (float)y, (float)z);

A qubit entangled with others sits inside the Bloch sphere — maximally entangled means the origin, which makes entanglement something you can actually see.

Built-in algorithms

using Qubit.NET.Circuits;

var grover = Algorithms.Grover(2, c => c.CZ(0, 1));   // marks |11>
Console.WriteLine(grover.ToHistogram());              // 11 | #########  1.000

var bv = Algorithms.BernsteinVazirani([true, false, true]);
Console.WriteLine(bv.Measure(2, 1, 0));               // 101

Also: Deutsch–Jozsa, teleportation, superdense coding, QFT, and the Bell and GHZ states.

Run on real hardware

using Qubit.NET.Export;

File.WriteAllText("bell.qasm", qc.ToQasm());
# Qiskit
qc = QuantumCircuit.from_qasm_file("bell.qasm")

What else is in the box

  • 27 gates — Pauli, Hadamard, phase, √X/√Y/√Z, rotations, U3, controlled forms, Toffoli, Fredkin, and your own unitary matrices
  • Mid-circuit measurement and classical feedforward — MeasureInto and When, enough for teleportation and error correction
  • Partial measurement of any subset of qubits
  • Pluggable randomness via IRandomSource — seed it for reproducible tests, or plug in a quantum RNG
  • In-place simulation — a 20-qubit GHZ chain runs in 34 ms and allocates one state vector, not one per gate

Up to 26 qubits; memory is the limit, since the state vector holds 2ⁿ complex amplitudes (20 qubits ≈ 16 MB, 24 ≈ 256 MB).


Full documentation, examples and source on GitHub →

MIT licensed. Issues and pull requests welcome.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 150 8/17/2026
1.0.0 124 8/17/2026

See CHANGELOG.md