mentpy
mentpy copied to clipboard
Add `witnesses_for` method on `MBQCircuit`
When considering Pauli Flow and other problems, knowing what qubits later in time have the responsibility of correcting errors on qubits earlier in time is useful.
A collection of witness methods
MBQCircuit.witnesses(v=None)- Returns some representation (set of Ments? Dict of Ments?) of all the witnesses of
v. If v=None return the entire dictionary.
- Returns some representation (set of Ments? Dict of Ments?) of all the witnesses of
MBQCircuit.witness(t, s)- Return True if
tis a witness ofselse False
- Return True if
MBQCircuit.correct(v)- Correct the value of
vand return some useful result
- Correct the value of
MBQCircuit.witness_matrix(d=None).- Matrix representation of the current switch state of a circuit at evaluation depth d? If d=None, then return the witness state of the circuit after completely evaluated.
@BestQuark thoughts on these methods and their feasibility/usefulness?
Hi Kenneth, thanks for opening this issue. These methods seem very useful!
Here are some small comments/thoughts:
MBQCircuit.witnesses(v=None)
For this first one, it might be better to return a set or list of vertices (so it's easier to use in PauliFlowAux). But feel free to judge and do what feels better to return here :)
MBQCircuit.witness(t, s)
- Return True if
tis a witness ofselse False
Yes! ✅
MBQCircuit.correct(v)
This is important -- although, I would say let's think about this function a bit more after having the other witness/pauli flow functions -- I think we might need to have an extra step to correct for previous outcomes.
Also, it might be better practice to have the measurement outcomes stored in the Simulator class instead of the MBQCircuit class (leaving the MBQCircuit unchanged after one [simulator].run() call), and when adapting the measured angles, we can call MBQCircuit.correct or adaptwithin[simulator]` and pass as an input both the node we want to fix + previous measurement outcomes.
MBQCircuit.witness_matrix(d=None).
- Matrix representation of the current switch state of a circuit at evaluation depth d? If d=None, then return the witness state of the circuit after completely evaluated.
I think I don't fully understand this method, do you mean the matrix of constraints $M_{A,u}$ from pag. 68 here? If this is the case, we first need to get the witnesses to then divide the circuit by layers (i.e., depth of a node). However, each node has a unique matrix, so we can make this method have as an input a node v.
Also, since these methods are artifacts that appear when dealing with flow, I think it makes sense to add them to the Flow class see here.
Let me know if you agree! @kennethbruskiewicz
@BestQuark I notice that link to the Flow class is not yet merged into main. Is that something we should do? Also does it have more up-to-date flow methods?