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

AmplitudeEstimation

class qiskit.algorithms.AmplitudeEstimation(num_eval_qubits, phase_estimation_circuit=None, iqft=None, quantum_instance=None, sampler=None)

GitHub(opens in a new tab)

Bases: AmplitudeEstimator

The Quantum Phase Estimation-based Amplitude Estimation algorithm.

This class implements the original Quantum Amplitude Estimation (QAE) algorithm, introduced by [1]. This canonical version uses quantum phase estimation along with a set of mm additional evaluation qubits to find an estimate a~\tilde{a}, that is restricted to the grid

a~{sin2(πy/2m):y=0,...,2m1}\tilde{a} \in \{\sin^2(\pi y / 2^m) : y = 0, ..., 2^{m-1}\}

More evaluation qubits produce a finer sampling grid, therefore the accuracy of the algorithm increases with mm.

Using a maximum likelihood post processing, this grid constraint can be circumvented. This improved estimator is implemented as well, see [2] Appendix A for more detail.

Note

This class does not support the EstimationProblem.is_good_state property, as for phase estimation-based QAE, the oracle that identifes the good states must be encoded in the Grover operator. To set custom oracles, the EstimationProblem.grover_operator attribute can be set directly.

References

[1]: Brassard, G., Hoyer, P., Mosca, M., & Tapp, A. (2000).

Quantum Amplitude Amplification and Estimation. arXiv:quant-ph/0005055(opens in a new tab).

[2]: Grinko, D., Gacon, J., Zoufal, C., & Woerner, S. (2019).

Iterative Quantum Amplitude Estimation. arXiv:1912.05559(opens in a new tab).

Deprecated since version 0.24.0

qiskit.algorithms.amplitude_estimators.ae.AmplitudeEstimation.__init__()’s argument quantum_instance is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. Instead, use the sampler argument. See https://qisk.it/algo_migration(opens in a new tab) for a migration guide.

Parameters

  • num_eval_qubits (int(opens in a new tab)) – The number of evaluation qubits.
  • phase_estimation_circuit (QuantumCircuit | None) – The phase estimation circuit used to run the algorithm. Defaults to the standard phase estimation circuit from the circuit library, qiskit.circuit.library.PhaseEstimation when None.
  • iqft (QuantumCircuit | None) – The inverse quantum Fourier transform component, defaults to using a standard implementation from qiskit.circuit.library.QFT when None.
  • quantum_instance (QuantumInstance |Backend | None) – Deprecated: The backend (or QuantumInstance) to execute the circuits on.
  • sampler (BaseSampler | None) – A sampler primitive to evaluate the circuits.

Raises

ValueError(opens in a new tab) – If the number of evaluation qubits is smaller than 1.


Attributes

quantum_instance

Get the quantum instance.

Deprecated since version 0.24.0

The property qiskit.algorithms.amplitude_estimators.ae.AmplitudeEstimation.quantum_instance is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. See https://qisk.it/algo_migration(opens in a new tab) for a migration guide.

Returns

The quantum instance used to run this algorithm.

Type

Deprecated

sampler

Get the sampler primitive.

Returns

The sampler primitive to evaluate the circuits.


Methods

compute_confidence_interval

static compute_confidence_interval(result, alpha=0.05, kind='likelihood_ratio')

Compute the (1 - alpha) confidence interval.

Parameters

  • result (AmplitudeEstimationResult) – An amplitude estimation result for which to compute the confidence interval.
  • alpha (float(opens in a new tab)) – Confidence level: compute the (1 - alpha) confidence interval.
  • kind (str(opens in a new tab)) – The method to compute the confidence interval, can be ‘fisher’, ‘observed_fisher’ or ‘likelihood_ratio’ (default)

Returns

The (1 - alpha) confidence interval of the specified kind.

Raises

NotImplementedError(opens in a new tab) – If the confidence interval method kind is not implemented.

Return type

tuple(opens in a new tab)[float(opens in a new tab), float(opens in a new tab)]

compute_mle

static compute_mle(result, apply_post_processing=False)

Compute the Maximum Likelihood Estimator (MLE).

Parameters

Returns

The MLE for the provided result object.

Return type

float(opens in a new tab)

construct_circuit

construct_circuit(estimation_problem, measurement=False)

Construct the Amplitude Estimation quantum circuit.

Parameters

  • estimation_problem (EstimationProblem) – The estimation problem for which to construct the QAE circuit.
  • measurement (bool(opens in a new tab)) – Boolean flag to indicate if measurements should be included in the circuit.

Returns

The QuantumCircuit object for the constructed circuit.

Return type

QuantumCircuit

estimate

estimate(estimation_problem)

Run the amplitude estimation algorithm on provided estimation problem.

Parameters

estimation_problem (EstimationProblem) – The estimation problem.

Returns

An amplitude estimation results object.

Raises

Return type

AmplitudeEstimationResult

evaluate_measurements

evaluate_measurements(circuit_results, threshold=1e-06)

Evaluate the results from the circuit simulation.

Given the probabilities from statevector simulation of the QAE circuit, compute the probabilities that the measurements y/gridpoints a are the best estimate.

Parameters

Returns

Dictionaries containing the a gridpoints with respective probabilities and

y measurements with respective probabilities, in this order.

Return type

tuple(opens in a new tab)[dict(opens in a new tab)[float(opens in a new tab), float(opens in a new tab)], dict(opens in a new tab)[int(opens in a new tab), float(opens in a new tab)]]

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