Add `witnesses_for` method on `MBQCircuit`
Opened this issue · 2 comments
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
t
is a witness ofs
else False
- Return True if
MBQCircuit.correct(v)
- Correct the value of
v
and 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
t
is a witness ofs
else 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 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?