1
$\begingroup$

I built a complex time-space dependent error model with Qiskit, and I am simulating surface codes with such error model to test their error correction capabilities. Qiskit supplies measurement data as a dictionary of counts for each bitstring that has been observed at least once.

By reading the documentation, I noted that PyMatching can be easily interfaced with Stim to test a plethora of pre-buit surface codes, however I am reluctant to switch to that simulator, since stabiliser-based simulation does not fit my needs.

How can I extract the error syndromes from Qiskit measurement data and create a syndrome graph compatible with matching algorithms such as PyMatching?

$\endgroup$

1 Answer 1

1
$\begingroup$

If you can build your noiseless circuit as a stabilizer circuit, specifically as a stim circuit with DETECTOR and OBSERVABLE_INCLUDE annotations, then stim can handle converting from measurement results to detection events that can be consumed by pymatching. If you put a simple noise model in that circuit, then it can also output a DetectorErrorModel that you can use to configure pymatching.

If you don't want to involve stim at all, or you can't due to not being able to explain your circuit as a stabilizer circuit, then you need to implement what Stim implemented. You need detectors: a list of sets of measurements to compare, where each set should have deterministic parity. From this list and the circuit you can compute the expected parity of each set by simulating the circuit noiselessly, and then determine whether the parity is correct or violated within a given shot. You can then, for each error mechanism, determine which measurement sets have their parity change when that error occurs. This allows you to derive the Tanner graph relating error mechanisms to detection events, and you can configure PyMatching by giving it the grahlike subset of this graph.

$\endgroup$
2
  • $\begingroup$ Thanks for the quick reply Craig. My understanding of surface code and stabiliser formalism is still limited, so I will try to go the "easy" route by integrating Stim. I first need to convert the Qiskit circuit in a Stim circuit by unrolling the Qiskit gates and adding them to a Stim circuit. My Qiskit circuits only use CNOT, X, H and measurement gates, so I should manage to do this. Then I will take my Qiskit measurement results and convert them to a format that Stim can read as "coming from a Stim simulation". Then I can feed these converted measurements to PyMatching. Is this doable? $\endgroup$ Feb 1 at 9:57
  • $\begingroup$ @MarzioVallero Yeah that sounds doable. $\endgroup$ Feb 1 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.