tqecd.utils.collapse_pauli_strings_at_moment#

collapse_pauli_strings_at_moment(moment: Circuit) list[PauliString][source]#

Compute and return the list of PauliString instances representing all the collapsing operations found in the provided moment.

This function has the following pre-condition: all the instructions in the provided moment should be instances of stim.CircuitInstruction.

This pre-condition can be ensured by only providing stim.Circuit instances returned by the iter_stim_circuit_by_moments function, ensuring before calling that the moment is not an instance of stim.CircuitRepeatBlock.

This function ensures that the returned Pauli strings are ordered w.r.t the qubit index the collapsing operation was applied on.

Parameters:

moment – A circuit moment that does not contain any stim.CircuitRepeatBlock instance.

Raises:

TQECDException – If the pre-conditions of this function are not met.

Returns:

instances of PauliString representing each collapsing operation found in the

provided moment, sorted by qubits.