Skip to main content
9 votes
Accepted

is cirq suitable for simulation of quantum error correction?

I wrote most (as in >50% not as in all) of the initial versions of cirq, and was its team lead for a couple years. I wouldn't recommend using Cirq as a tool for simulating QEC codes. Cirq is first ...
Craig Gidney's user avatar
  • 38.6k
7 votes
Accepted

Incorporating idling errors while using stim

No, there's no simple built-in way. You have to do it for yourself. This was an intentional design choice, which I will now attempt to justify because I do realize it's inconvenient. Stim has no ...
Craig Gidney's user avatar
  • 38.6k
6 votes
Accepted

'Best practices' for making Stim run as fast as possible?

Output format: Use a bit packed output format that has 8 results per byte instead of 1. In the python bindings, this means calling sample_bit_packed instead of <...
Craig Gidney's user avatar
  • 38.6k
5 votes
Accepted

What is the meaning of "shots" and "rounds" in Stim?

A shot is a full run of a circuit. If your circuit contains 100 measurements, sampling a shot from that circuit will produce 100 bits of measurement information. A round is a concept used by the ...
Craig Gidney's user avatar
  • 38.6k
5 votes

Measuring entanglement entropy using a stabilizer circuit simulator

I think stim is the right tool for the job here, because it gives you access to the stabilizer generators and also it defines stim.PauliString which you can use to ...
Craig Gidney's user avatar
  • 38.6k
5 votes
Accepted

How can I visualize a stim circuit?

Since v1.10, you can use stim.Circuit.diagram to visualize the circuit. ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

Performing a generic single-qubit Pauli error channel in stim

Update: Since v1.4, stim supports custom pauli channels PAULI_CHANNEL_1(px, py, pz) and PAULI_CHANNEL_2(pix, piy, ..., pzz). ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

Measuring entanglement entropy using a stabilizer circuit simulator

With the help of Craig Gidney and some others, I was able to pin down the procedure to calculate the entropy. Here are the steps. Create your circuit with a stabilizer simulator This can be done with ...
Germ's user avatar
  • 315
4 votes
Accepted

Computing expectation value of a Pauli string on stabilizer states

You can use stim.TableauSimulator.peek_observable_expectation to compute the expected value of Pauli product observables without affecting the simulator's state: <...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

Where do lines like "error(0.00033) D0 D9 L0 ^ D7 ^ D8" come from in a stim detector error model?

[What does error(0.0033) D0 D9 L0 ^ D7 ^ D8 mean?] It is declaring an error mechanism that occurs 0.33% of the time. When this error occurs, it simultaneously ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

How do I perform an erasure error in stim?

Since stim v1.12, you can use the HERALDED_ERASE gate or the HERALDED_PAULI_CHANNEL_1 gate to get heralded erasures. Note that ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

QecSim vs Stim for simulating QEC

Probably the biggest difference between qecsim and stim is that qecsim is stabilizer-focused whereas stim is circuit-focused. In qecsim, a code is defined as a set of stabilizers. For example, it ...
Craig Gidney's user avatar
  • 38.6k
4 votes

how to apply pauli string depending on multiple control qubits (qiskit or stim)

Qiskit provides PauliGate which makes it really easy to achieve that: ...
Egretta.Thula's user avatar
4 votes

Converting $T_1$ and $T_2$ decay rates to noise supported by stim

You can use equations 9-10 of this paper to extract the corresponding Pauli error probabilities: https://arxiv.org/pdf/1404.3747.pdf $$p_X = p_Y = \frac{1-e^{-t/T_1}}{4}$$ $$p_Z = \frac{1-e^{-t/T_2}}{...
user13176662's user avatar
4 votes

Converting $T_1$ and $T_2$ decay rates to noise supported by stim

Trouble with amplitude damping channel Phase damping channel is implemented in stim as Z_ERROR, see here. Amplitude damping is not supported as explicitly stated in ...
Adam Zalcman's user avatar
4 votes
Accepted

How does Stim's detector sampler work?

curious how it knows what it should be "the same" as on its very first shot The expected value of the detector is equal to its value when running the circuit without noise. This ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

What's hook error in surface code?

A hook error is an error that occurs in the middle of a stabilizer measurement cycle, producing symptoms that would require multiple data errors when not in the middle of the cycle. For example, one ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

Bug in stim HERALDED_PAULI_CHANNEL_1?

Update: This is fixed in stim~=1.12.1 and in stim~=1.13.dev1701377008. The only stable version affected was 1.12.0, since ...
Craig Gidney's user avatar
  • 38.6k
4 votes
Accepted

What is the best way to parallelise processes across multiple cores when computing logical error rates with Stim and PyMatching?

(Sounds like you want sinter. In particular you should check out sinter.collect. It's for exactly this task, but supports additional features such as the ability to ...
Craig Gidney's user avatar
  • 38.6k
3 votes

Is there any reasonably efficient way of performing qudit circuit simulations using Stim?

Since you're mentioning Stim, I guess you mean stabilizer circuits. I do not know about the capabilities of Stim, but judging from the documentation, it seems to work only for qubits. Nevertheless, ...
Markus Heinrich's user avatar
3 votes
Accepted

Simulating flag qubits and conditional branches using Stim

This is definitely a place where you'll struggle to use Stim. It's possible but it's not nice. It could still be worth your time just because you don't have to eg. manually write code to turn a ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

Stim: is it possible to add comments when creating a circuit?

No, the python API doesn't support adding comments. Neither does the underlying C++ API, actually. Comments are completely discarded by the parser, and the circuit struct has no fields for storing ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

Measurement bitstrings to detection event bitstrings in stim

You can use stim.Circuit.compile_m2d_converter to get an object that converts measurements into detection event data (and optionally also observable flip data). The ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

How do I initialize stim's tableau simulator to a random tableau?

You can use stim.TableauSimulator.set_inverse_tableau to change the tableau simulator's state to a specific tableau, such as a random tableau from ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

Efficient Way to Create an LUT in Stim

The simplest thing to do would be to make a pair of collections.Counters, sample the circuit millions of times, and add the result-flipped cases into one counter ...
Craig Gidney's user avatar
  • 38.6k
3 votes

How do I perform an erasure error in stim?

Adding my two cents on "finding a decoder that understands the erasures" - here are slides I made in the past, which seems to be valid for the newly updated HERALDED_ERASE feature in Stim as ...
Mingyu Kang's user avatar
3 votes
Accepted

Within Stim, how to trace back DEM error instructions to Stim circuit faults

Use stim.Circuit.explain_detector_error_model_errors, like this: ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

Finding all possible n-qubit Clifford gates (for n<5) in stim

The method stim.Tableau.iter_all iterates over all tableaus. This method doesn't exist in 1.9 (the current stable version), but you can get it in the latest dev ...
Craig Gidney's user avatar
  • 38.6k
3 votes
Accepted

OpenQASM circuits in Stim

This isn't directly supported by qiskit or by stim, but you can try using cirq as an intermediary. I don't know how consistently this works, but it works on simple cases. ...
Craig Gidney's user avatar
  • 38.6k
3 votes

qiskit : how to measure multiple pauli strings

Note: The answer below is for measuring a single Pauli string, which turns out not to be what the question wants (after clarification). You can implement your own function of Pauli measurement. ...
Senrui Chen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible