Supported Gates
Tsim supports a universal gate set, together with measurement and reset instructions, and Pauli noise channels.Clifford Instructions
Tsim supports all instructions supported by Stim. Below, we show the standard generating set of Clifford gates:Output
Output
Output
Non-Clifford Instructions
In addition to Clifford gates, Tsim supports the following non-Clifford gates. Note that all rotation parameters are defined in units of . Computation time and memory requirement scales exponentially with the number of non-Clifford gates.Output
Output
Output
Output
Output
Measurement and Reset instructions
Tsim supports all collapsing gates supported by Stim.
Measurements (
M, MX, MY, MZ) project the state into the measurement basis and write the resulting bit into the measurement record.
The measurement record can be used to conditionally apply Pauli gates:
The
! operator can be used to invert the classical measurement bit that is written into the measurement record:
The
MPP instruction measures Pauli strings. The MPP can also be used in conjunction with the ! operator to flip the classical measurement bit before writing it into the measurement record.
The
MXX, MYY, and MZZ instructions measure two-qubit Pauli parity. For example, MZZ measures whether pairs of qubits are in the same-parity subspace () or opposite-parity subspace ().
The
MPAD instruction pads the measurement record with fixed bit values (0 or 1), without performing any actual measurement.
The
SPP instruction applies (up to global phase) for a Pauli product , which is equivalent to phasing the eigenspace of by . For example, SPP Z0 is equivalent to the S gate, and SPP X0*X1 is equivalent to SQRT_XX. The SPP_DAG instruction applies (phases by ) instead. The ! operator inverts the product, swapping SPP and SPP_DAG behavior.
Similarly,
TPP applies (up to global phase), phasing the eigenspace by . TPP_DAG applies (phases by ).
Noise Channels
Tsim supports all noise channels supported by Stim. TheX_ERROR(p) instruction is a X instruction that is applied with probability p.
The
PAULI_CHANNEL_1(p_x, p_y, p_z) instruction is a X, Y, and Z instruction that is applied with probabilities p_x, p_y, and p_z respectively.
The
PAULI_CHANNEL_2 instruction takes fifteen floats specifying the disjoint probabilities of each possible Pauli pair
that can occur (except for the non-error double identity case).
The disjoint probability arguments are (in order):
p_ix,
p_iy,
p_iz,
p_xi,
p_xx,
p_xy,
p_xz,
p_yi,
p_yx,
p_yy,
p_yz,
p_zi,
p_zx,
p_zy,
p_zz
The
DEPOLARIZE1(p) instruction applies a randomly chosen Pauli with probability p.
The
DEPOLARIZE2(p) instruction applies a randomly chosen two-qubit Pauli with probability p.
The
CORRELATED_ERROR(p) instruction applies a specified Pauli product with probability p. If no error occurred, then a following ELSE_CORRELATED_ERROR(p2) instruction may apply a Pauli product with probabiliy p2. If no error occurs again, further ELSE_CORRELATED_ERROR(pi) instructions in the chain may apply a Pauli products.
Annotations
Tsim supports detector and observable annotations. TheDETECTOR instruction is only used in detector sampling mode and ignored otherwise. It instructs the detector sampler to record the XOR of classical outcomes of specified measurement bits.
The
OBSERVABLE_INCLUDE instruction is only used in observable sampling mode and ignored otherwise. It instructs the detector sampler to record the XOR of the specified measurement bits.
Sampling
Tsim supports multiple samplers. The first is a measurement sampler. This will simply sample bits for each measurement instruction in the circuit. Detector and observable annotations will simply be ignored by this sampler.Output
Output
CompiledStateProbs sampler.
Output
Output
Output
Output
Visualization
Tsim supports multiple ways of visualizing quantum circuits. Thetimeline-svg diagram shows the circuit as a time-ordered sequence of gates.
When
TICK instructions are present, each tick can be shown as a 2D time slice with the timeslice-svg diagram. Here, QUBIT_COORDS annotations can be used to specify the 2D coordinates of the qubits.
With the
pyzx argument, the circuit can be visualized using the pyzx as a ZX-diagram.
The
pyzx-meas and pyzx-dets diagrams show ZX diagrams where outputs represent probabilities of measurement outcomes for measurement and detector/observables, respectively.
Detector Error Models
Tsim allows to compute detector error models from a circuit. The methodCircuit.detector_error_model() computes a stim.DetectorErrorModel from the circuit. As opposed to Stim, detectors and observables need not be deterministic.
Output