Iterative Quantum Amplitude Estimation#
- IQAE(qargs, state_function, eps, alpha, mes_kwargs={})[source]#
Accelerated Quantum Amplitude Estimation (IQAE). This function performs QAE with a fraction of the quantum resources of the well-known QAE algorithm. See Accelerated Quantum Amplitude Estimation without QFT.
The problem of iterative quantum amplitude estimation is described as follows:
Given a unitary operator
, let .Write
as a superposition of the orthogonal good and bad components of .Find an estimate for
, the probability that a measurement of yields a good state.
- Parameters:
- qargslist[QuantumVariable]
The list of QuantumVariables which represent the state, the quantum amplitude estimation is performed on. The last variable in the list must be of type QuantumBool.
- state_functionfunction
A Python function preparing the state
. This function will receive the variables in the listqargs
as arguments in the course of this algorithm.- epsfloat
Accuracy
of the algorithm.- alphafloat
Confidence level
of the algorithm.- mes_kwargsdict, optional
The keyword arguments for the measurement function. Default is an empty dictionary.
- Returns:
- afloat
An estimate
of such that
Examples
We show the same Numerical integration example which can also be found in the QAE documentation.
We wish to evaluate
For this, we set up the corresponding
state_function
acting on the variables ininput_list
:from qrisp import QuantumFloat, QuantumBool, control, z, h, ry, IQAE import numpy as np n = 6 inp = QuantumFloat(n,-n) tar = QuantumBool() input_list = [inp, tar]
For example, if
, thestate_function
can be implemented as follows:def state_function(inp, tar): h(inp) N = 2**inp.size for k in range(inp.size): with control(inp[k]): ry(2**(k+1)/N,tar)
Finally, we apply IQAE and obtain an estimate
for the value of the integral .a = IQAE(input_list, state_function, eps=0.01, alpha=0.01)
>>> a 0.26782038552705856