Skip to main content

Module tableau_simulator

Module tableau_simulator 

Source
Expand description

Stabilizer-frame Clifford+T simulator.

§State representation

The engine tracks ticit’s CliffordFrame $R$ and a sparse complex amplitude map over destabilizer-coset labels. Writing $S_i = R Z_i R^\dagger$ (stabilizers) and $D_i = R X_i R^\dagger$ (destabilizers) where these are image_z(i) and image_x(i), respectively,

$$ \lvert\psi\rangle = \sum_c \operatorname{xvec}[c] D^c \lvert\psi_0\rangle, \qquad \lvert\psi_0\rangle = R\lvert0\ldots0\rangle, \qquad D^c = \prod_{i:c_i=1} D_i. $$

The clean way to see the whole scheme: $D^c\lvert\psi_0\rangle = R\lvert c\rangle$, so $\lvert\psi\rangle = R\lvert\chi\rangle$ with $\lvert\chi\rangle = \sum_c \operatorname{xvec}[c]\lvert c\rangle$ the rotated state $R^\dagger\lvert\psi\rangle$. The amplitude map is $\lvert\chi\rangle$ in the computational basis. This gives every operation directly:

  • A Clifford gate $G$ sends $\lvert\psi\rangle \to G\lvert\psi\rangle$, i.e. $R \to G R$ (a left_mul), and leaves $\lvert\chi\rangle$ — the amplitude map — untouched.
  • $T_P$ and measurement act on $\lvert\psi\rangle$ as a $T$ gate or projector about $P$, which in the rotated frame is the same operation about $Q = R^\dagger P R$ (preimage(P)), acting on the computational-basis vector $\lvert\chi\rangle$.

§Pauli decomposition in the frame

For a Pauli $P$, $Q = R^\dagger P R = i^k X^a Z^b$ with $a$ the x-bits, $b$ the z-bits and $k$ the phase exponent of the X-then-Z normal form (not xyz_phase_exponent). Then on a basis term,

$$ Q\lvert c\rangle = i^k (-1)^{\langle b,c\rangle}\lvert c \oplus a\rangle. $$

Everything that sweeps the amplitude map is generic over its packed label type instead of dispatching per term.

Structs§

MeasureResult
Outcome of a Pauli measurement.
TableauSimulator
A stim-TableauSimulator-style procedural Clifford+T simulator.

Enums§

SimError
Errors returned by TableauSimulator operations.