UnitaryLab Simulator User Manual
Overview
This manual is intended for developers who want to build, execute, analyze, and export quantum circuits using the Python interface.
UnitaryLab is a Python quantum circuit simulator that provides a complete toolchain from high-level circuit construction to low-level statevector execution. With it you can:
- Build arbitrary quantum circuits using the
CircuitAPI - Run statevector / tensor-network simulations via
execute()on four backends:torch(default),numpy,cpp, andtensornet - Visualize and analyze circuit structure with
draw()andanalyze() - Exchange circuits with other quantum platforms via OpenQASM 2.0 / 3.0
- Call high-level algorithms from the algorithm library, such as QFT, QPE, LCU, QSP, QSVT, block encoding, Hamiltonian simulation, and linear system solving
Installation and Version
pip install unitarylabimport unitarylab
print(unitarylab.__version__)Reading Guide
Depending on your use case, we recommend reading in the following order:
| Scenario | Recommended reading |
|---|---|
| First time using UnitaryLab, quick start | Quick Start |
| Understanding the full API and module entry points | API Usage Overview |
| Building quantum circuits and adding gate operations | Core Circuit Interface |
| Executing circuits, inspecting results, drawing, analysis, and OpenQASM | Circuit Workflow |
| Using algorithms such as QFT, QPE, HHL | Algorithms and Utility Library |
Module Structure Overview
unitarylab/
├── core/ # User-facing layer: Circuit, Register, ClassicalRegister, CircuitExecutor facade, Transpiler facade
├── backend/ # Gate/gate-sequence data structures, statevector and tensor-network executors, device configuration, NumPy/PyTorch/C++ gate kernels, observable parsing, QASM import/export
├── transpiler/ # Circuit transpilation: gate-basis decomposition, rule-based optimization (Circuit.transpile())
├── codegen/ # Circuit → Python source code generation (Circuit.to_python())
├── circuit_analysis/ # Circuit static analysis: CircuitInfo (Circuit.analyze())
├── drawer/ # Circuit drawing: CircuitDrawer (mpl / text / latex output formats)
├── info/ # Terminal output helper utilities
└── library/ # Algorithm library: QFT, QPE, LCU, QSP, QSVT, block encoding, Hamiltonian simulation, linear system solving, etc.For the vast majority of use cases, you only need from unitarylab import Circuit, Register, ClassicalRegister (or the equivalent from unitarylab.core import ...) — there is no need to interact with the lower-level modules directly.
Next Steps
- Run your first quantum circuit in 5 minutes → Quick Start
- See each module’s import paths and the API layering → API Usage Overview
Last updated on