modified_iterative_quantum_ae
This module contains the mIQAE class. Given a quantum oracle operator, this class estimates the probability of a given target state using a modification of the IQAE algorithm based on the paper:
Fukuzawa, Shion and Ho, Christopher and Irani, Sandy and Zion, Jasen Modified Iterative Quantum Amplitude Estimation is Asymptotically Optimal. Society for Industrial and Applied Mathematics. 2023 Proceedings of the Symposium on Algorithm Engineering and Experiments (ALENEX). 2023
Author: Gonzalo Ferro Costas & Alberto Manzano Herrero
- class QQuantLib.AE.modified_iterative_quantum_ae.mIQAE(oracle: qat.lang.AQASM.QRoutine, target: list, index: list, **kwargs)
Class for Iterative Quantum Amplitude Estimation (IQAE) algorithm
- Parameters:
oracle (QLM gate) – QLM gate with the Oracle for implementing the Grover operator
target (list of ints) – python list with the target for the amplitude estimation
index (list of ints) – qubits which mark the register to do the amplitude estimation
kwargs (dictionary) – dictionary that allows the configuration of the IQAE algorithm: Implemented keys:
qpu (kwargs, QLM solver) – solver for simulating the resulting circuits
epsilon (kwargs, float) – precision
alpha (kwargs, float) – accuracy
shots (kwargs, int) – number of measurements on each iteration
mcz_qlm (kwargs, bool) – for using or not QLM implementation of the multi controlled Z gate
- static chebysev_bound(n_samples: int, gamma: float)
Computes the length of the confidence interval for a given number of samples n_samples and an accuracy gamma:
\[\epsilon = \dfrac{1}{\sqrt{2N}}\log\left(\dfrac{2}{\gamma} \ \right)\]- Parameters:
n_samples (int) – number of samples
gamma (float) – accuracy
- Returns:
length of the confidence interval
- Return type:
float
- static compute_info(epsilon: float = 0.01, shots: int = 100, alpha: float = 0.05)
This function computes theoretical values of the IQAE algorithm.
- Parameters:
epsilon (float) – precision
alpha (float) – accuracy
shots (int) – number of measurements on each iteration
- Returns:
info – python dictionary with the computed information
- Return type:
dict
- static confidence_intervals(a_min: float, a_max: float, ri: int)
Computes the confidence intervals
- Parameters:
a_min (float) – minimum amplitude measured in the round
a_max (float) – maximum amplitude measured in the round
ri (int) – number of quadrants passed to get the current angle
- static display_information(epsilon: float = 0.01, shots: int = 100, alpha: float = 0.05)
This function displays information of the properties of the method for a given set of parameters
- Parameters:
epsilon (float) – precision
alpha (float) – accuracy
shots (int) – number of measurements on each iteration
- static find_next_k(k: int, theta_lower: float, theta_upper: float)
This is an implementation of Algorithm 2 from the mIQAE paper. This function computes the next suitable k.
- Parameters:
k (int) – number of times to apply the grover operator to the quantum circuit
theta_lower (float) – lower bound for the estimation of the angle
theta_upper (float) – upper bound for the estimation of the angle
- Returns:
k – number of times to apply the grover operator to the quantum circuit
- Return type:
int
- property index
creating index property
- miqae(epsilon: float = 0.01, shots: int = 100, alpha: float = 0.05)
This function implements Algorithm 1 from the IQAE paper. The result is an estimation of the desired probability with precision at least epsilon and accuracy at least alpha.
- Parameters:
epsilon (float) – precision
alpha (float) – accuracy
shots (int) – number of measurements on each iteration
- Returns:
a_l (float) – lower bound for the probability to be estimated
a_u (float) – upper bound for the probability to be estimated
- property oracle
creating oracle property
- quantum_step(k)
Create the quantum routine needed for the iqae step
- Parameters:
k (int) – number of Grover operator applications
- Returns:
routine – qlm routine for the iqae step
- Return type:
qlm routine
- run()
run method for the class.
- Returns:
amplitude estimation parameter
- Return type:
self.ae
- property target
creating target property