AbstractMeasurement

Here we define a struct which represents measurement.

Documents

GroverAlgorithm.AbstractMeasurementType
AbstractMeasurement

Abstract type for quantum measurements performed on MPS after circuit execution. Encapsulates different measurement strategies for quantum states.

source
GroverAlgorithm.ExpectationValueType
ExpectationValue(operator::Symbol, qubits::Vector{Int})

Represents an expectation value measurement of a physical operator.

Computes ⟨ψ|Ô|ψ⟩ where Ô is the specified operator acting on the given qubits.

Fields

  • operator::Symbol: The operator symbol (e.g., :X, :Y, :Z, :H, :Sz).
  • qubits::Vector{Int}: The qubit indices where the operator acts (1-based).

Example

ExpectationValue(:Z, [1])  # Measure ⟨Z⟩ on qubit 1
ExpectationValue(:X, [1, 2])  # Measure ⟨X₁X₂⟩ on qubits 1 and 2
source
GroverAlgorithm.ProjectiveMeasurementType
ProjectiveMeasurement(qubit::Int)

Represents a projective measurement on a specific qubit.

Measures a single qubit in the computational basis and collapses the state.

Fields

  • qubit::Int: The qubit index to measure (1-based).

Example

ProjectiveMeasurement(1)  # Measure qubit 1
source
GroverAlgorithm.SamplingType
Sampling(shots::Int)

Represents a sampling measurement in the computational basis.

Performs repeated measurements to obtain a probability distribution over basis states.

Fields

  • shots::Int: The number of measurement samples to collect.

Example

Sampling(1000)  # Perform 1000 measurements
source