Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

IterativeAmplitudeEstimation

IterativeAmplitudeEstimation(epsilon, alpha, confint_method='beta', min_ratio=2, a_factory=None, q_factory=None, i_objective=None, quantum_instance=None)

GitHub(opens in a new tab)

The Iterative Amplitude Estimation algorithm.

This class implements the Iterative Quantum Amplitude Estimation (QAE) algorithm, proposed in https://arxiv.org/abs/1912.05559(opens in a new tab). The output of the algorithm is an estimate that, with at least probability 1 - alpha, differs by epsilon to the target value, where both alpha and epsilon can be specified.

It differs from the original QAE algorithm proposed by Brassard (https://arxiv.org/abs/quant-ph/0005055(opens in a new tab)) in that it does not rely on Quantum Phase Estimation, but is only based on Grover’s algorithm. Iterative IQAE iteratively applies carefully selected Grover iterations to find an estimate for the target amplitude.

The output of the algorithm is an estimate for the amplitude a, that with at least probability 1 - alpha has an error of epsilon. The number of A operator calls scales linearly in 1/epsilon (up to a logarithmic factor).

Parameters

  • epsilon (float) – Target precision for estimation target a, has values between 0 and 0.5
  • alpha (float) – Confidence level, the target probability is 1 - alpha, has values between 0 and 1
  • confint_method (str) – Statistical method used to estimate the confidence intervals in each iteration, can be ‘chernoff’ for the Chernoff intervals or ‘beta’ for the Clopper-Pearson intervals (default)
  • min_ratio (float) – Minimal q-ratio (K_{i+1} / K_i) for FindNextK
  • a_factory (Optional[CircuitFactory]) – The A operator, specifying the QAE problem
  • q_factory (Optional[CircuitFactory]) – The Q operator (Grover operator), constructed from the A operator
  • i_objective (Optional[int]) – Index of the objective qubit, that marks the ‘good/bad’ states
  • quantum_instance (Union[QuantumInstance, BaseBackend, None]) – Quantum Instance or Backend

Raises

AquaError – if the method to compute the confidence intervals is not supported


Attributes

a_factory

Get the A operator encoding the amplitude a that’s approximated, i.e.

A |0>_n |0> = sqrt{1 - a} |psi_0>_n |0> + sqrt{a} |psi_1>_n |1>

see the original Brassard paper (https://arxiv.org/abs/quant-ph/0005055(opens in a new tab)) for more detail.

Returns

the A operator as CircuitFactory

Return type

CircuitFactory

backend

qiskit.providers.basebackend.BaseBackend

Returns backend.

Return type

BaseBackend

i_objective

Get the index of the objective qubit. The objective qubit marks the |psi_0> state (called ‘bad states’ in https://arxiv.org/abs/quant-ph/0005055(opens in a new tab)) with |0> and |psi_1> (‘good’ states) with |1>. If the A operator performs the mapping

A |0>_n |0> = sqrt{1 - a} |psi_0>_n |0> + sqrt{a} |psi_1>_n |1>

then, the objective qubit is the last one (which is either |0> or |1>).

If the objective qubit (i_objective) is not set, we check if the Q operator (q_factory) is set and return the index specified there. If the q_factory is not defined, the index equals the number of qubits of the A operator (a_factory) minus one. If also the a_factory is not set, return None.

Returns

the index of the objective qubit

Return type

int

precision

float

Returns the target precision epsilon of the algorithm.

Return type

float

Returns

The target precision (which is half the width of the confidence interval).

q_factory

Get the Q operator, or Grover-operator for the Amplitude Estimation algorithm, i.e.

Q = -A S_0 A^{-1} S_psi0,

where S_0 reflects about the |0>_n state and S_psi0 reflects about |psi_0>_n. See https://arxiv.org/abs/quant-ph/0005055(opens in a new tab) for more detail.

If the Q operator is not set, we try to build it from the A operator. If neither the A operator is set, None is returned.

Returns

returns the current Q factory of the algorithm

Return type

QFactory

quantum_instance

Union[None, qiskit.aqua.quantum_instance.QuantumInstance]

Returns quantum instance.

Return type

Optional[QuantumInstance]

random

Return a numpy random.


Methods

construct_circuit

IterativeAmplitudeEstimation.construct_circuit(k, measurement=False)

Construct the circuit Q^k A |0>.

The A operator is the unitary specifying the QAE problem and Q the associated Grover operator.

Parameters

  • k (int) – The power of the Q operator.
  • measurement (bool) – Boolean flag to indicate if measurements should be included in the circuits.

Return type

QuantumCircuit

Returns

The circuit Q^k A |0>.

run

IterativeAmplitudeEstimation.run(quantum_instance=None, **kwargs)

Execute the algorithm with selected backend.

Parameters

Returns

results of an algorithm.

Return type

dict

Raises

AquaError – If a quantum instance or backend has not been provided

set_backend

IterativeAmplitudeEstimation.set_backend(backend, **kwargs)

Sets backend with configuration.

Return type

None

Was this page helpful?
Report a bug or request content on GitHub.