IterativePhaseEstimation

class IterativePhaseEstimation(num_iterations, sampler=None, *, transpiler=None, transpiler_options=None)[source]

Bases: PhaseEstimator

Run the Iterative quantum phase estimation (QPE) algorithm.

Given a unitary circuit and a circuit preparing an eigenstate, return the phase of the eigenvalue as a number in \([0,1)\) using the iterative phase estimation algorithm.

[1]: Dobsicek et al. (2006), Arbitrary accuracy iterative phase estimation algorithm as a two

qubit benchmark, arxiv/quant-ph/0610214

Parameters:
  • num_iterations (int) – The number of iterations (rounds) of the phase estimation to run.

  • sampler (BaseSamplerV2 | None) – The sampler primitive on which the circuit will be sampled.

  • transpiler (Transpiler | None) – An optional object with a run method allowing to transpile the circuits that are produced within this algorithm. If set to None, these won’t be transpiled.

  • transpiler_options (dict[str, Any] | None) – A dictionary of options to be passed to the transpiler’s run method as keyword arguments.

Raises:

Methods

construct_circuit(unitary, state_preparation, k, omega=0.0, measurement=False)[source]

Construct the kth iteration Quantum Phase Estimation circuit.

For details of parameters, see Fig. 2 in https://arxiv.org/pdf/quant-ph/0610214.pdf.

Parameters:
  • unitary (QuantumCircuit) – The circuit representing the unitary operator whose eigenvalue (via phase) will be measured.

  • state_preparation (QuantumCircuit) – The circuit that prepares the state whose eigenphase will be measured. If this parameter is omitted, no preparation circuit will be run and input state will be the all-zero state in the computational basis.

  • k (int) – the iteration idx.

  • omega (float) – the feedback angle.

  • measurement (bool) – Boolean flag to indicate if measurement should be included in the circuit.

Returns:

the quantum circuit per iteration

Return type:

QuantumCircuit

estimate(unitary, state_preparation=None)[source]

Estimate the eigenphase of the input unitary and initial-state pair.

Parameters:
  • unitary (QuantumCircuit) – The circuit representing the unitary operator whose eigenvalue (via phase) will be measured.

  • state_preparation (QuantumCircuit | None) – The circuit that prepares the state whose eigenphase will be measured. If this parameter is omitted, no preparation circuit will be run and input state will be the all-zero state in the computational basis.

Returns:

Estimated phase in an IterativePhaseEstimationResult object.

Raises:

AlgorithmError – If a sampler is not provided.

Return type:

IterativePhaseEstimationResult