fiqci.ems.transpiler_passes.pauli_twirl

fiqci.ems.transpiler_passes.pauli_twirl#

Functions

get_twirled_circuits(circuits, num_twirls[, ...])

Generate twirled circuits from input circuits.

Classes

PauliTwirl(*args, **kwargs)

Add Pauli twirls to two-qubit gates.

class PauliTwirl(*args, **kwargs)#

Bases: TransformationPass

Add Pauli twirls to two-qubit gates.

__init__(gates_to_twirl: Iterable[Gate] | None = None)#
Parameters:

gates_to_twirl – Gates to twirl. The default behavior is to twirl all two-qubit basis gates.

run(dag: DAGCircuit) DAGCircuit#

Run a pass on the DAGCircuit. This is implemented by the pass developer.

Parameters:

dag – the dag on which the pass is run.

Raises:

NotImplementedError – when this is left unimplemented for a pass.

get_twirled_circuits(circuits: list[QuantumCircuit], num_twirls: int, gates_to_twirl: Iterable[Gate] | None = None, backend: IQMBackendBase | None = None) list[QuantumCircuit]#

Generate twirled circuits from input circuits.

For each input circuit, produces the original circuit followed by num_twirls twirled copies, giving groups of (num_twirls + 1) circuits in a flat list.

Parameters:
  • circuits – List of QuantumCircuits to generate twirled circuits from.

  • num_twirls – Number of twirled circuits to generate per input circuit.

  • gates_to_twirl – Optional list of gates to twirl, if None, all two-qubit basis gates will be twirled. backend: The backend to transpile the circuits for.

Returns:

[orig_0, twirl_0_1, …, twirl_0_T, orig_1, twirl_1_1, …, twirl_1_T, …].

Return type:

Flat list of circuits