1

It seems that when decoding 3D graph, pymatching only gives the overall decoding edges and only takes spacelike-weights in 2D graph which means the weights are the same in each round. So I'd like to know if pymatching supports assigning different weights to and get the decoding edges from 2D graphs in each round.

Martin Vesely
  • 15,398
  • 4
  • 32
  • 75
lyt
  • 21
  • 2

2 Answers2

1

As far as I can tell, there is no notion of 2D graph vs 3D graph in pymatching.

The only location I can think of where this could arise is when using Matching.from_check_matrix with its argument repetition set above 1. Note that as per the documentation, you can also give in these cases a measurement_error_probabilities parameter. It allows for fine-tuning the individual syndrome error rates, (although they will be equal between all the rounds). Calling each duplicated layer deduced from the check matrix a "2D graph" is a matter of taste, "space-like" would be probably better because the underlying code may already have dimension $\geq 3$.

However, this is just one way of initializing it. If you need control on what is being decoded, you can use Matching.from_stim_circuit if you have a stim experiment, or directly give the decoding graph (with Matching.from_networkx [here] or equivalent). The latter let you set the weights or probabilities as you want (you can have a look at the graph underlying an already defined Matching with the to_networkx method).

In all cases, once initialized, the Matching object loses all information about rounds or repetitions and only cares about the underlying abstract decoding graph. Only one decoding will be performed, computing a matching going along data errors edges / syndrome errors indiscriminately from the whole decoding graph.

The reason why it outputs only overall decoding edges is because the underlying decoding graph has the fault_ids parameter for each edge set in a specific way : data errors corresponding to the same qubit have the same fault_ids (because their effect on the state is the same regardless of when they occurred) and syndrome errors have none (because a syndrome error does not corrupt the state itself).

The output of Matching.decode is by default a correction to apply to move the state back to the codespace, and thus corresponds to a subset of the matched edges indicating which data qubits need to be flipped. It is only if an odd number of matched edges across different rounds share a fault_id that such a fault_id is added to the correction. No syndrome errors can be added because they have no fault_ids parameter.

It is possible to get the whole set of matched data (and/or syndrome) errors by ensuring that each of them have a unique fault_ids. This is most easily done if you use the Matching.from_networkx initialization with a modified graph you got with Matching.to_networkx from an already initialized Matching.

Note that fault_ids can either be an integer or a set of integers. This means you can keep the already defined ones and add yours as needed. You would thus be able to get both the correction and the set of matched edges from the decode call. Another use of fault_ids as sets is to track logical errors, but it is a bit beyond the scope of this question.

AG47
  • 1,650
  • 3
  • 16
1

I have solved this problem. Here is the solution.

Q: The problem is basicly summarized as how to fine set the params in graph

A: Using pymatching to decode in phenomenological error model (contain syndrome error) gives the overall decoding data error edges and no syndrome error edges by default, this is because the data error edges in each round has the same fault_ids, and the syndrome error edge has the empty set as fault_ids. So you need to set the fault_ids manually to make them differ. You can do this by using Matching.add_edge() api. So if you need to set weights as you want, the way is the same

lyt
  • 21
  • 2