2
$\begingroup$

I'm trying to implement code capacity/phenomenological simulation for the rotated surface code from scratch (without using any specialized package like stim/pymatching). I have two questions.
Could anyone kindly help me check my workflow is correct? And any simplification?

  1. Define qubit coordinates, stabilizers with the qubits they connect to
  2. Random generate a binary error array, indicating whether $i$-th qubit has X/Z-type error
  3. Based on the error, generate syndromes
  4. Build matching graph, syndromes as the nodes, I build a complete graph with edge weight being proportional to the Chebyshev distance (in unrotated case you just use the Manhatten distance, but in the rotated case you need to walk diagonally)
  5. Decode the syndrome by min-weight-matching, obtaining pairs of syndrome nodes, find the shortest diagonal path between them. Flip data qubits along the path.
  6. Check intersection between the error and logical operator, decide logical error or not.

Second question is, while performing simulation, I realize that technically I need some "virtual check qubits", which I do not yet have in my current code. I think I understand that these virtual qubits are needed to avoid some error causing only 1 flagged check. But I'm not sure where and how to put in my current workflow. My thinking is, I'll define them in #1, as a separate set of stabilizers. In #3 I can generate the syndromes as the real stabilizers. But in #4 I'm not sure how to build the graph. From a figure in a paper I saw, it's not exactly, I have the real+virtual check and I build a complete graph. It seems like virtual checks only connect the nearest real checks? How do I implement this? Also edge weights? I have the impression that with virtual checks some edge weights need to be set as 0, how and why? Besides, it seems like in the matching these virtual checks can be left unmatched, how should I address this in the implementation?

Thanks!!

iOlius et al

$\endgroup$

1 Answer 1

3
$\begingroup$

The workflow seems correct (of-course, if you don't have a specific circuit-based model in mind, you can just work with the syndromes directly).

Regarding the virtual checks: you need the ability to connect a syndrome to the boundary. Without it, if - for example - the boundary qubit is flipped, only one syndrome will be affected, and you can't use the standard matching for it, as it require matching pairs of syndromes.

As such, you defined virtual checks, which are actually just syndromes that are connected to a single qubit. That is, they are flipped only if it is flipped. The edge in the syndrome graphs runs "through" this qubit, and connect the nearest bulk syndrome to this virtual one (exactly like in the bulk itself where two nearest syndromes are connected). If this qubit is flipped, the algorithm should match the bulk syndrome with the virtual one, correctly flipping back this qubit.

These virtual checks are still there and need to be matched somewhere. That is why you connect them with 0-weight edges, such that the algorithm can just match them in pairs to each other, avoiding flipping any real qubit.

By the way, even if you want to implement it by yourself, which is great, it is always helpful just to look in STIM to see how it is implemented there. You can see the circuit, the detector-error-model and the matching graph, and try to understand why it is so.

$\endgroup$

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.