qrunch.quantum.algorithms.pauli.quantum_phase_estimation.bayesian_quantum_phase_estimation

Module containing the bayesian quantum phase estimation algorithm.

Classes

BayesianQuantumPhaseEstimation

Bayesian Quantum Phase Estimation (BQPE) algorithm.

BayesianQuantumPhaseEstimationOptions

Options for BayesianQuantumPhaseEstimation.

class BayesianQuantumPhaseEstimation

Bases: object

Bayesian Quantum Phase Estimation (BQPE) algorithm.

__init__(hamiltonian_encoder: TrotterizationHamiltonianEncoder, sampler: Sampler, shots: int | None = None, options: BayesianQuantumPhaseEstimationOptions | None = None) None

Initialise the Bayesian QPE algorithm.

Parameters:
  • hamiltonian_encoder (TrotterizationHamiltonianEncoder) – Trotterization encoder that constructs \(e^{-iHt}\) for each Hadamard test round.

  • sampler (Sampler) – Sampler used to execute each Hadamard test circuit.

  • shots (int | None) – Hardware batch size — number of circuit executions per Hadamard test round. Pass a positive integer to use exact binomial likelihoods (recommended for real hardware); None uses the statevector expectation value directly (soft likelihood, useful for noiseless simulation).

  • options (BayesianQuantumPhaseEstimationOptions | None) – Algorithm options including the candidate grid size and number of iterations.

Return type:

None

run(state_preparation_circuit: Circuit, hamiltonian: HermitianPauliSum) ExpectationValue

Execute the Bayesian QPE algorithm, returning the estimated eigenvalue.

Parameters:
  • state_preparation_circuit (Circuit) – Circuit preparing an approximate eigenstate \(|\psi\rangle\) on the \(m\)-qubit state register.

  • hamiltonian (HermitianPauliSum) – The Hermitian Pauli Hamiltonian \(H\) whose eigenvalue is estimated.

Return type:

ExpectationValue

class BayesianQuantumPhaseEstimationOptions

Bases: DataclassPublicAPI

Options for BayesianQuantumPhaseEstimation.

Parameters:
  • number_of_candidate_values – Number of candidate eigenvalues discretizing \([-\\lambda, \\lambda]\). A larger value gives finer eigenvalue resolution. (default=1_000_000)

  • max_number_of_iterations – Maximum number of Hadamard test circuit submissions. Each submission runs shots measurements. (default=20)

  • tolerance – Posterior standard deviation below which iteration stops early. (default=1e-4)

  • convergence_rate – Exponential scaling factor applied to the log-likelihood at each update. This can be seen as the effective number of shots used in the Bayesian update. A smaller value gives more conservative updates that may help convergence when the likelihood is noisy. (default=10.0)

__init__(*, number_of_candidate_values: int = 1000000, max_number_of_iterations: int = 20, tolerance: float = 0.0001, convergence_rate: float = 10.0) None
Parameters:
  • number_of_candidate_values (int)

  • max_number_of_iterations (int)

  • tolerance (float)

  • convergence_rate (float)

Return type:

None

convergence_rate: float = 10.0
max_number_of_iterations: int = 20
number_of_candidate_values: int = 1000000
tolerance: float = 0.0001