Sampling from a tableau?
BrunoLiegiBastonLiegi opened this issue · 2 comments
Is there any way to directly generate the samples starting from a tableau and not a circuit?
I understand that the standard way is to compile the sampler starting from the circuit
import stim
c = stim.Circuit('''
X 2
M 0 1 2
''')
s = c.compile_sampler()
s.sample(shots=1)
but I was wondering whether the CompiledMeasurementSampler
it produces could be directly initialized from a tableu, and maybe the qubits one wants to measure.
What exactly would it be sampling? The state with the stabilizers of the tableau? I think this is well covered by something like
c = tableau.to_circuit("graph_state")
c.append("M", range(c.num_qubits))
s = c.compiler_sampler()
What exactly would it be sampling? The state with the stabilizers of the tableau? I think this is well covered by something like
c = tableau.to_circuit("graph_state") c.append("M", range(c.num_qubits)) s = c.compiler_sampler()
Ah I see, indeed, you can always convert to a circuit and sample measurements from there. Yep I think this works for what I need, thanks!