AmplitudeEstimation

class AmplitudeEstimation(num_eval_qubits, state_preparation=None, grover_operator=None, objective_qubits=None, post_processing=None, phase_estimation_circuit=None, iqft=None, quantum_instance=None, a_factory=None, q_factory=None, i_objective=None)[source]

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 \(m\) additional evaluation qubits to find an estimate \(\tilde{a}\), that is restricted to the grid

\[\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 \(m\).

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.

References

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

Quantum Amplitude Amplification and Estimation. arXiv:quant-ph/0005055.

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

Iterative Quantum Amplitude Estimation. arXiv:1912.05559.

Parameters
  • num_eval_qubits (int) – The number of evaluation qubits.

  • state_preparation (Union[QuantumCircuit, CircuitFactory, None]) – A circuit preparing the input state, referred to as \(\mathcal{A}\).

  • grover_operator (Union[QuantumCircuit, CircuitFactory, None]) – The Grover operator \(\mathcal{Q}\) used as unitary in the phase estimation circuit.

  • objective_qubits (Optional[List[int]]) – A list of qubit indices to specify the oracle in the Grover operator, if the Grover operator is not supplied. A measurement outcome is classified as ‘good’ state if all objective qubits are in state \(|1\rangle\), otherwise it is classified as ‘bad’.

  • post_processing (Optional[Callable[[float], float]]) – A mapping applied to the result of the algorithm \(0 \leq a \leq 1\), usually used to map the estimate to a target interval.

  • phase_estimation_circuit (Optional[QuantumCircuit]) – The phase estimation circuit used to run the algorithm. Defaults to the standard phase estimation circuit from the circuit library, qiskit.circuit.library.PhaseEstimation.

  • iqft (Optional[QuantumCircuit]) – The inverse quantum Fourier transform component, defaults to using a standard implementation from qiskit.circuit.library.QFT when None.

  • quantum_instance (Union[QuantumInstance, Backend, BaseBackend, None]) – The backend (or QuantumInstance) to execute the circuits on.

  • a_factory (Optional[CircuitFactory]) – Deprecated, use state_preparation. The CircuitFactory subclass object representing the problem unitary.

  • q_factory (Optional[CircuitFactory]) – Deprecated, use grover_operator. The CircuitFactory subclass object representing an amplitude estimation sample (based on a_factory).

  • i_objective (Optional[int]) – Deprecated, use objective_qubits. The index of the objective qubit, i.e. the qubit marking ‘good’ solutions with the state \(|1\rangle\) and ‘bad’ solutions with the state \(0\rangle\).

Attributes

AmplitudeEstimation.a_factory

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

AmplitudeEstimation.backend

Returns backend.

AmplitudeEstimation.grover_operator

Get the \(\mathcal{Q}\) operator, or Grover operator.

AmplitudeEstimation.i_objective

Get the index of the objective qubit.

AmplitudeEstimation.objective_qubits

Get the criterion for a measurement outcome to be in a ‘good’ state.

AmplitudeEstimation.q_factory

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

AmplitudeEstimation.quantum_instance

Returns quantum instance.

AmplitudeEstimation.random

Return a numpy random.

AmplitudeEstimation.state_preparation

Get the \(\mathcal{A}\) operator encoding the amplitude \(a\).

Methods

AmplitudeEstimation.confidence_interval(alpha)

Compute the (1 - alpha) confidence interval.

AmplitudeEstimation.construct_circuit([…])

Construct the Amplitude Estimation quantum circuit.

AmplitudeEstimation.is_good_state(measurement)

Determine whether a given state is a good state.

AmplitudeEstimation.post_processing(value)

Post processing of the raw amplitude estimation output \(0 \leq a \leq 1\).

AmplitudeEstimation.run([quantum_instance])

Execute the algorithm with selected backend.

AmplitudeEstimation.set_backend(backend, …)

Sets backend with configuration.