1

I am working on QECC and, differently from classical ECC where everything is generally described by the parity-check matrices, QECC generally involves the low-level description of the circuit instead, enabling different kinds of noises.

I am interested in extracting the binary parity-check matrix from a given Stim circuit.

For example, given:

import stim
L=5
p=0.005    
circuit = stim.Circuit.generated("surface_code:rotated_memory_x",
                                distance=L,
                                rounds=L,
                                after_clifford_depolarization=p,
                                before_round_data_depolarization=p,
                                after_reset_flip_probability=p,
                                before_measure_flip_probability=p)

how can we obtain the parity-check matrix H from circuit, i.e., H = get_pc_matrix(circuit).

PS: I am aware of the nice other way around described here

EDIT I think I found a solution from the BeliefMatching git repo, by using the function detector_error_model_to_check_matrices

yoyoc
  • 11
  • 2
  • Could you clarify exactly what you expect the parity check matrix to be? Like, what datatype and what do the rows means and the columns mean and etc. I'm assuming you're aware that any dense representation, like a 2d numpy array with a column for each measurement and a row for each detector, is likely to be enormous and cumbersome even for small sized circuits. – Craig Gidney Aug 02 '23 at 18:45
  • @CraigGidney The parity check matrix should be binary, so the datatype is arbitrary (it can be bool, long, etc.).

    I don't think the matrix should be enormous, at least not for small distance codes. For example, for the L=5 surface code given in the question, the parity matrix is supposed to be ~40x82.

    – yoyoc Aug 03 '23 at 06:09
  • The circuit given in the question has 145 measurements, 120 detectors, and 1679 observationally-distinct error mechanisms, so I'm not sure where you're getting 40x82. What's the 40 and what's the 82? – Craig Gidney Aug 03 '23 at 16:36
  • You are right. Regarding the dimensions I gave, I assumed the parity matrix of a standard surface code created for example as a Hypergraph product of codes (no noise or rounds). The code above gives a 120x1679 parity matrix as you said (please see EDIT). With rounds=1 the parity matrix is of size 24x77
    
    H=  detector_error_model_to_check_matrices(model).check_matrix```
    
    – yoyoc Aug 03 '23 at 18:25

0 Answers0