iqm.benchmarks.utils_shadows.local_shadow_tomography

iqm.benchmarks.utils_shadows.local_shadow_tomography#

iqm.benchmarks.utils_shadows.local_shadow_tomography(qc: QuantumCircuit, n_unitaries: int, active_qubits: Sequence[int], measure_other: Sequence[int] | None = None, measure_other_name: str | None = None, clifford_or_haar: Literal['clifford', 'haar'] = 'clifford', cliffords_1q: dict[str, QuantumCircuit] | None = None) tuple[ndarray | dict[str, list[str]], list[QuantumCircuit]]#

Prepares the circuits to perform local Haar or Clifford shadow tomography.

Parameters:
  • qc (QuantumCircuit) – The quantum circuit to which random unitaries are appended.

  • n_unitaries (int) – Number of local random unitaries used.

  • active_qubits (Sequence[int]) – The Sequence of active qubits.

  • measure_other (Sequence[int] | None) – Whether to measure other qubits in the qc QuantumCircuit.

  • measure_other_name (str | None) – Name of the classical register to assign measure_other.

  • clifford_or_haar (Literal['clifford', 'haar']) – Whether to use Clifford or Haar random 1Q gates.

  • cliffords_1q (dict[str, QuantumCircuit] | None) – Dictionary of 1-qubit Cliffords in terms of IQM-native r and CZ gates.

Raises:
  • ValueError – If clifford_or_haar is not “clifford” or “haar”.

  • ValueError – If cliffords_1q is None and clifford_or_haar is “clifford”.

Returns:

  • Unitary gate (numpy ndarray),

    composed of local unitaries for each random initialisation and qubit, if clifford_or_haar == ‘haar’.

  • Dictionary of lists of Clifford labels corresponding to each RM,

    keys being str(qubit), if clifford_or_haar == ‘clifford’.

List of tomography circuits.

Return type:

Random unitaries, in either format