tqec
architecture#
This document is mainly targeted at a developer wanting to contribute to the
tqec
library. It provides a high-level overview of the different pieces that compose
the tqec
library and how they interact with each other.
Warning
This is a rapidly evolving project — codebase might change. If you encounter any inconsistencies, please open an issue.
This is done by presenting each of the sub-modules and their main classes / methods
in the order in which they are used internally to go from a topological computation to
an instance of stim.Circuit
that can be executed on compatible hardware.
The diagram below provides a high-level overview of the dependencies between tqec
submodules. It is not 100% accurate, as for example the tqec.circuit
submodule
defines a few core data-structures that are used in tqec.plaquette
, but this is
the order in which the sub-modules will be covered here.
--- config: darkMode: 'true' theme: base --- %%{ init: { 'theme': 'base', 'themeVariables': { 'primaryColor': '#AFEEEE', 'lineColor': '#6495ED' } } }%% graph A[tqec.interop] --> B[tqec.computation] B --> E[tqec.compile] C[tqec.templates] --> E D[tqec.plaquette] --> E E --> F[tqec.circuit] F --> G[tqec.utils.noise_models] G --> H[tqec.simulation]
A user starts with a computation and an observable. The input computation can be provided as a BlockGraph
structure while an observable is represented as a correlation surface. The end goal of tqec
is to generate a stim.Circuit
such that the input is transformed into a topologically quantum error corrected quantum computation protected by a surface code.
interop
#
Allows a user to provide a .dae
file or a pyzx
graph as an input to tqec
.
A
BlockGraph
can be constructed through a Collada.dae
file throughread_block_graph_from_dae_file()
and vice versa throughwrite_block_graph_to_dae_file()
.A ZX graph can be mapped to a
BlockGraph
throughblock_synthesis()
.
Standard color representations as described in Terminology are predefined in TQECColor
.
Some conventional implementations of computations in .dae
format are available in the Computation Gallery.
computation
#
Defines data structures for the high-level BlockGraph
representations of a fault-tolerant computation protected by the surface code.
The 3D
structures discussed in detail in Terminology are defined in this module.
A
CorrelationSurface
represents a set of parity measurements between the input and output logical operators.A
Cube
is a fundamental building block constituting of a block of quantum operations that occupy a specific spacetime volume. Quantum information encoded in the logical qubits can be preserved or manipulated by these blocks.A
Pipe
is a block that connectsCube
objects in aBlockGraph
but does not occupy spacetime volume on its own. The exception here are temporal hadamard pipes that have a volume when compiled using the fixed bulk convention.PipeKind
helps determine the kind of a pipe in aBlockGraph
based on the wall bases at the head of the pipe in addition to a Hadamard transition.Port
depicts the open ports in aBlockGraph
.A
YHalfCube
represents Y-basis initialization and measurements.ZXCube
defines cubes with only X or Z basis boundaries.
compile
#
Responsible for translations between internal representations.
BlockGraph
obtained from the functionality in interop is further translated into a TopologicalComputationGraph
represented
by Block
instances.
--- config: darkMode: 'true' theme: base --- %%{ init: { 'theme': 'base', 'themeVariables': { 'primaryColor': '#AFEEEE', 'lineColor': '#6495ED' } } }%% graph A[BlockGraph] --> B[Topological <br> Computation Graph] --> C[ScheduledCircuit]--> D[stim.Circuit]
Multiple block builder protocols defined in tqec.compile.spec.library
will take the high-level structure of a block to
templates and plaquettes, that can in turn be used to generate a fully annotated stim.Circuit
.
templates
#
Generates an array of numbers representing a 2-dimensional, scalable, arrangement of plaquettes. This allows us to describe a circuit that can scale the desired code distance.
plaquette
#
A plaquette is the representation of a local quantum circuit. A surface code patch implements one layer in time or one round of the surface code. Same as
templates
, this module allows us to define scalable quantum circuits.
circuit
#
Implementation of ScheduledCircuit
, a quantum circuit representation in tqec, where each and every gate of a regular quantum circuit is associated with the time of execution. This module
maps from the numbered templates to some plaquettes that implement small local circuits to measure a stabilizer as a ScheduledCircuit
instance.
NoiseModel
#
Note
The code for this module was modified from the code for [1].
This module implements the following noise models for Stim
simulations:
Superconducting Inspired Circuit Error Model (SI1000): A modified version of the noise model introduced in [2] which represents the noise on Google’s superconducting quantum chip.
Uniform Depolarizing Noise: Single qubit depolarizing noise is uniformly applied to both single qubit and two qubit Clifford gates.
The result of dissipative gates is probabilistically bit or phase flipped.
Result of non-demolition measurements is flipped instead of the input qubit.
simulation
#
Utilities related to quantum circuit simulations through sinter
, a Python submodule in stim
.
Plotting functions are in this module too.
References#
Craig Gidney. Inplace access to the surface code y basis. Quantum, 8:1310, April 2024. URL: http://dx.doi.org/10.22331/q-2024-04-08-1310, doi:10.22331/q-2024-04-08-1310.
Craig Gidney, Michael Newman, Austin Fowler, and Michael Broughton. A fault-tolerant honeycomb memory. Quantum, 5:605, December 2021. URL: http://dx.doi.org/10.22331/q-2021-12-20-605, doi:10.22331/q-2021-12-20-605.