I am wondering what the details of the unrotated memory x code available as a generated code in stim are. What does the 'memory X' refer to, and are the boundary conditions periodic?


1 Answer 1


In surface_code:rotated_memory_x the rotated means the boundaries are rotated 45 degrees relative to the first boundaries people used. This rotation was introduced in "Surface code quantum computing by lattice surgery". The memory means the circuit implements a memory experiment. The x means the circuit initializes and measures the logical X basis observable.

The boundaries are planar, not periodic. A quick way to verify this is to make a diagram of the circuit's stabilizers:

# in a Jupyter notebook e.g. run this at https://colab.research.google.com

!pip install stim
import stim
circuit = stim.Circuit.generated("surface_code:rotated_memory_x", rounds=10, distance=5)
circuit.diagram(type="detector-slice-svg", tick=9)

enter image description here

You'll get slightly different images depending on which tick you pick, since the gates deform the stabilizers as the circuit runs, but the smaller stabilizers forming the planar boundaries always stand out.

This is tick=11, at the halfway point of the cycle:

enter image description here

This is tick=10:

enter image description here

The "usual" picture would be at the time between an M layer and an R layer, but unfortunately the generated circuits uses the combined MR operation so there's no tick to give that picture.

  • $\begingroup$ Thanks for the response! Is there a straightforward way to change the boundaries to being periodic? $\endgroup$
    – Juliette
    Commented Nov 10, 2022 at 0:23
  • $\begingroup$ @Juliette nope, you'd have to make your own circuit for that. $\endgroup$ Commented Nov 10, 2022 at 6:24

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.