qrunch.quantum.measurement.bases.clifford_measurement_basis
Module defining a Clifford measurement basis and Clifford circuit synthesis.
Classes
A measurement basis defined by a Clifford circuit that diagonalizes a set of commuting Pauli strings. |
|
The synthesis of a set of commuting Pauli strings. |
|
A relation expressing a Pauli string as a product of other Pauli strings. |
- class CliffordMeasurementBasis
Bases:
objectA measurement basis defined by a Clifford circuit that diagonalizes a set of commuting Pauli strings.
The
CliffordSynthesisResultcontains a circuit, together with a collection of independent Pauli strings and relations for the dependent ones. The circuit has the property that measuring in the Z basis after applying the circuit is equivalent to measuring the independent Pauli strings, and the ordering is such that the first Pauli string corresponds to the measurement of the first qubit.- __init__(synthesis: CliffordSynthesisResult) None
Initialise a new
CliffordMeasurementBasis.- Parameters:
synthesis (CliffordSynthesisResult) – The Clifford synthesis result describing the diagonalizing circuit and the independent/dependent Pauli string structure.
- Return type:
None
- calculate_expectation_value(pauli_sum: HermitianPauliSum, measurement: QuantumMeasurement) ExpectationValue
Calculate the expectation value of
pauli_sumfrom a measurement in this basis.After applying the diagonalizing Clifford circuit, qubit
imeasures the eigenvalue of the i’th independent Pauli string. The dependent Pauli strings can be reconstructed from the independent ones using the relations, and the expectation value of the full sum can be calculated from the measurement results.- Parameters:
pauli_sum (HermitianPauliSum) – The Pauli sum whose expectation value is to be estimated.
measurement (QuantumMeasurement) – Measurement results obtained after applying the diagonalizing circuit.
- Return type:
- classmethod from_pauli_strings(pauli_strings: Sequence[PauliString]) CliffordMeasurementBasis
Create a
CliffordMeasurementBasisfrom a sequence of mutually commuting Pauli strings.- Parameters:
pauli_strings (Sequence[PauliString]) – A sequence of mutually commuting Pauli strings.
- Return type:
- Requirements:
Machine: linux-x86_64 or darwin-arm64
- get_diagonalizing_circuit(num_qubits: int) Circuit
Return the Clifford circuit that diagonalizes this basis.
The circuit size is determined by the synthesis and the
num_qubitsargument is unused; it exists only to satisfy theMeasurementBasisprotocol.- Parameters:
num_qubits (int) – Number of qubits in the circuit.
- Return type:
- is_compatible_with(other: PauliString) bool
Check whether
othercan be measured in this basis.A Pauli string is compatible if it is the identity, one of the independent Pauli strings captured by the synthesis, or one of the dependent strings expressed as a linear combination of those.
- Parameters:
other (PauliString) – The Pauli string to check.
- Return type:
bool
- is_diagonal() bool
Check if the basis is already diagonal, i.e. the diagonalizing circuit is empty.
- Return type:
bool
- class CliffordSynthesisResult
Bases:
objectThe synthesis of a set of commuting Pauli strings.
- Parameters:
circuit – The Clifford circuit with the property that applying it after preparing a state, and measuring in the Z basis, is equivalent to measuring the independent Pauli strings. The ordering is such that the first Pauli string corresponds to the measurement of the first qubit.
independent_pauli_strings – A list of independent Pauli strings; the ones which are directly measured by the circuit.
relations – A dictionary mapping dependent Pauli strings to their relations with the independent ones.
- __init__(circuit: Circuit, independent_pauli_strings: tuple[PauliString, ...], relations: tuple[PauliStringRelation, ...]) None
- Parameters:
circuit (Circuit)
independent_pauli_strings (tuple[PauliString, ...])
relations (tuple[PauliStringRelation, ...])
- Return type:
None
- independent_pauli_strings: tuple[PauliString, ...]
- relations: tuple[PauliStringRelation, ...]
- class PauliStringRelation
Bases:
objectA relation expressing a Pauli string as a product of other Pauli strings.
- Parameters:
pauli_string – The target Pauli string being expressed.
phase – The complex phase factor in the relation.
related_pauli_strings – The list of Pauli strings which, when multiplied together (and multiplied by the phase), yield the target Pauli string.
- __init__(pauli_string: PauliString, phase: complex, related_pauli_strings: tuple[PauliString, ...]) None
- Parameters:
pauli_string (PauliString)
phase (complex)
related_pauli_strings (tuple[PauliString, ...])
- Return type:
None
- pauli_string: PauliString
- phase: complex