Stim Tools#
Stim is a fast simulator for Clifford circuits. It is capable of simulating circuits with thousands of qubits and millions of operations in seconds. This performance is achieved by restricting the allowed gates to the Clifford group. This group is generated by the Hadamard gate, the Phase gate, and the CNOT gate. While this set of gates is not universal, it is sufficient to simulate a wide range of quantum error correction protocols.
Stim is designed to simulate noisy quantum circuits. It allows to insert Pauli noise into the circuit simulation, which is a good approximation for many physical noise sources. Qrisp provides an interface to Stim, that allows to convert Qrisp circuits to Stim circuits.
Constructing Stim Circuits with Qrisp#
In order to leverage Stim’s high performance compilation pipeline, Qrisp offers two ways to directly construct Stim circuits from your Qrisp code.
Method to convert the given QuantumCircuit to a Stim Circuit. |
|
Decorator that extracts a Stim circuit from a Jasp-traceable function. |
Inserting Noise#
A crucial feature of Stim is precise control over what type of noise can appear during the circuit execution and a very powerful simulation pipeline. In order to describe this Qrisp offers two options for realizing arbitrary noise channels.
Applies a Stim error gate to the given qubits. |
|
Class for representing Stim errors in Qrisp circuits. |
|
Permutes the detectors in a Stim circuit according to the given permutation. |
Warning
Every noisy operation described here behaves as a purely unitary identity gate, unless the compilation target is indeed Stim (see to_stim()). This means for instance that to_qiskit() converts the noisy operations to trivial identity gates. The same applies to the behavior of the Qrisp simulator. In other words - the noisy operations will only behave noisy if pushed through the Stim compiler.
Detectors and Observables#
In Stim, detectors are annotations asserting that a set of measurement outcomes has a deterministic parity. Observables are similar structures tracking logical information.
Qrisp allows you to define these structures using the general-purpose parity() function, or automatically discover them using find_detectors().
Performs a parity check on measurement results. Creates Stim detectors or observables when used within |
|
Decorator that automatically identifies stim detectors via tqecd and emits parity calls. |
|
A handle representing a parity result with its expanded clbits. Returned by detector/observable maps. |