0
$\begingroup$

I am trying to learn stim to simulate noisy quantum circuits. My goal is to construct an adaptive circuit in which I can add quantum gates one by one and observe the changes in the circuit's check matrix at each step. However, I've encountered a challenge with Stim which seems to prevent obtaining the tableau representation directly from a circuit if it includes any form of noise.

Here are my specific questions:

  1. Is there a way to get the check matrix (tableau) using noisy simulation in stim?

  2. Is there a built-in feature or a workaround in Stim that allows for the separation and accumulation of noise effects from the quantum gates within the circuit? Ideally, I'd like to track the noise separately as I build the circuit gate by gate.

  3. If so, is it possible to apply this accumulated noise to the circuit's tableau at a later stage? This way, I could analyze the final state of the circuit as if the noise had been part of the original sequence of gates, enabling a clearer understanding of the noise's impact.

I appreciate any insights, suggestions, or workarounds that the community can offer on this matter. Thank you!

$\endgroup$

1 Answer 1

0
$\begingroup$

Is there a way to get the check matrix (tableau) using noisy simulation in stim

The 'check matrix' and the 'tableau' are very different concepts, so I'm not sure what you mean. The check matrix / Tanner graph / detector error model can be computed non-adaptively using stim.Circuit.detector_error_model. A stabilizer tableau describing the state at each moment can be retrieved using stim.TableauSimulator.current_inverse_tableau.

Is there a built-in feature or a workaround in Stim that allows for the separation and accumulation of noise effects from the quantum gates within the circuit? Ideally, I'd like to track the noise separately as I build the circuit gate by gate.

You can use a stim.TableauSimulator() to track the state and a stim.FlipSimulator(batch_size=1, disable_stabilizer_randomization=True) to track errors.

Both simulators have a sim.do(...) method that takes a stim.Circuit or a stim.CircuitInstruction. For each noiseless gate you want to do, send it to both simulators. For each noise you want to apply, send it only to the flip simulator.

Now you can track what errors are doing by using stim.FlipSimulator.peek_pauli_flips. Don't forget that, when you measure a qubit, the true result is the xor of the tableau simulator's result and what you get from stim.FlipSimulator.get_measurement_flips.

If so, is it possible to apply this accumulated noise to the circuit's tableau at a later stage?

Yes, take the Pauli operators from the flip simulator and apply them to the tableau.

$\endgroup$
6
  • $\begingroup$ Thank you so much. Could you please let me know how to apply the Pauli operators from the flip simulator to the tableau, I find that append does not seem to work? Specifically, I do the following: tableau_simulator.current_inverse_tableau().append(flip_simulator.peek_pauli_flips()) Is there some other commands to do that? Sorry if the question is too elementary. $\endgroup$ Commented Apr 9 at 11:20
  • $\begingroup$ @iknownothing You need to invert the inverse tableau with t**-1 to get the normal tableau that you'd append to. $\endgroup$ Commented Apr 9 at 11:43
  • $\begingroup$ Yes, but still it somehow does not work: ``` tableau_simulator = stim.TableauSimulator() flip_simulator = stim.FlipSimulator(batch_size=1, disable_stabilizer_randomization=True, num_qubits=5) cir = stim.Circuit() cir.append('H', 0) cir.append('CX', [0, 1]) cir.append('CX', [0, 2]) for op in cir: tableau_simulator.do(op) flip_simulator.do(op) flip_simulator.do(stim.Circuit(''' DEPOLARIZE1(0.1) 0 1 2 ''')) T = tableau_simulator.current_inverse_tableau()**-1 F = flip_simulator.peek_pauli_flips() T.append(F) ``` $\endgroup$ Commented Apr 9 at 12:13
  • $\begingroup$ TypeError: append(): incompatible function arguments. The following argument types are supported: 1. (self: stim._stim_polyfill.Tableau, gate: stim._stim_polyfill.Tableau, targets: List[int]) -> None $\endgroup$ Commented Apr 9 at 12:15
  • $\begingroup$ @iknownothing Read the documentation of what peek returns. You'll need to convert it into what tableau append expects. $\endgroup$ Commented Apr 9 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.