qrunch.quantum.measurement.bases.clifford_measurement_basis

Module defining a Clifford measurement basis and Clifford circuit synthesis.

Classes

CliffordMeasurementBasis

A measurement basis defined by a Clifford circuit that diagonalizes a set of commuting Pauli strings.

CliffordSynthesisResult

The synthesis of a set of commuting Pauli strings.

PauliStringRelation

A relation expressing a Pauli string as a product of other Pauli strings.

class CliffordMeasurementBasis

Bases: object

A measurement basis defined by a Clifford circuit that diagonalizes a set of commuting Pauli strings.

The CliffordSynthesisResult contains 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_sum from a measurement in this basis.

After applying the diagonalizing Clifford circuit, qubit i measures 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:

ExpectationValue

classmethod from_pauli_strings(pauli_strings: Sequence[PauliString]) CliffordMeasurementBasis

Create a CliffordMeasurementBasis from a sequence of mutually commuting Pauli strings.

Parameters:

pauli_strings (Sequence[PauliString]) – A sequence of mutually commuting Pauli strings.

Return type:

CliffordMeasurementBasis

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_qubits argument is unused; it exists only to satisfy the MeasurementBasis protocol.

Parameters:

num_qubits (int) – Number of qubits in the circuit.

Return type:

Circuit

is_compatible_with(other: PauliString) bool

Check whether other can 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: object

The 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:
Return type:

None

circuit: Circuit
independent_pauli_strings: tuple[PauliString, ...]
relations: tuple[PauliStringRelation, ...]
class PauliStringRelation

Bases: object

A 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:
Return type:

None

pauli_string: PauliString
phase: complex
related_pauli_strings: tuple[PauliString, ...]