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
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