AbstractMeasurement
Here we define a struct which represents measurement.
Documents
GroverAlgorithm.AbstractMeasurement — Type
AbstractMeasurementAbstract type for quantum measurements performed on MPS after circuit execution. Encapsulates different measurement strategies for quantum states.
GroverAlgorithm.ExpectationValue — Type
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 2GroverAlgorithm.ProjectiveMeasurement — Type
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 1GroverAlgorithm.Sampling — Type
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