iqm.benchmarks.utils_shadows.local_shadow_tomography#
- iqm.benchmarks.utils_shadows.local_shadow_tomography(qc: QuantumCircuit, Nu: 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.
Nu (int) – Number of local random unitaries used.
active_qubits (Sequence[int]) – The Sequence of active qubits.
measure_other (Optional[Sequence[int]]) – Whether to measure other qubits in the qc QuantumCircuit. * Default is None.
measure_other_name (Optional[str]) – Name of the classical register to assign measure_other.
clifford_or_haar (Literal["clifford", "haar"]) – Whether to use Clifford or Haar random 1Q gates. * Default is “clifford”.
cliffords_1q (Optional[Dict[str, QuantumCircuit]]) – Dictionary of 1-qubit Cliffords in terms of IQM-native r and CZ gates. * Default is None.
- Raises:
ValueError – If clifford_or_haar is not “clifford” or “haar”.
ValueError – If cliffords_1q is None and clifford_or_haar is “clifford”.
- Returns:
- ndarray | Dict[str, List[str]]: Either:
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[QuantumCircuit]: List of tomography circuits.
- Return type:
Tuple[np.ndarray | Dict[str, List[str]], List[QuantumCircuit]]