shots_real_quantum_ae

This module contains the sRQAE class. Given a quantum oracle operator, this class estimates the amplitude of a given target state using a modification of the RQAE algorithm where the user can provide the number of shots for the generated quantum circuits. Usually the experimental performance of this modification is better than the original RQAE one.

Original RQAE papper:

Manzano, A., Musso, D., Leitao, A. Real Quantum Amplitude Estimation EPJ Quantum Technol. 10, 2 (2023) https://doi.org/10.1140/epjqt/s40507-023-00159-0

Author: Gonzalo Ferro Costas & Alberto Manzano Herrero

class QQuantLib.AE.shots_real_quantum_ae.sRQAE(oracle: qat.lang.AQASM.QRoutine, target: list, index: list, **kwargs)

Class for Real Quantum Amplitude Estimation (RQAE) 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

  • qpu (kwargs, QLM solver) – solver for simulating the resulting circuits

  • q (kwargs, int) – amplification ratio

  • epsilon (kwargs, int) – precision

  • gamma (kwargs, float) – accuracy

  • 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.

Parameters:
  • n_samples (int) – number of samples

  • gamma (float) – accuracy

Return type:

length of the confidence interval

static compute_info(ratio: float = 2, epsilon: float = 0.01, gamma: float = 0.05, shots: int = 100)

This function computes theoretical values of the IQAE algorithm.

Parameters:
  • ratio (float) – amplification ratio/policy

  • epsilon (float) – precision

  • gamma (float) – accuracy

Returns:

info – python dictionary with the computed information

Return type:

dict

static display_information(ratio: float = 2, epsilon: float = 0.01, gamma: float = 0.05, shots: int = 100)

This function displays information of the properties of the method for a given set of parameters

Parameters:
  • ratio (float) – amplification ratio/policy

  • epsilon (float) – precision

  • gamma (float) – accuracy

first_step(shift: float, shots: int, gamma: float)

This function implements the first step of the RQAE paper. The result is a first estimation of the desired amplitude.

Parameters:
  • shift (float) – shift for the first iteration

  • shots (int) – number of measurements

  • gamma (float) – accuracy

Returns:

  • amplitude_min (float) – lower bound for the amplitude to be estimated

  • amplitude_max (float) – upper bound for the amplitude to be estimated

property index

creating index property

property oracle

creating oracle property

run()

run method for the class.

Returns:

amplitude estimation parameter

Return type:

self.ae

run_step(shift: float, shots: int, gamma: float, k: int)

This function implements a step of the RQAE paper. The result is a refined estimation of the desired amplitude.

Parameters:
  • shift (float) – shift for the first iteration

  • shots (int) – number of measurements

  • gamma (float) – accuracy

  • k (int) – number of amplifications

Returns:

  • amplitude_min (float) – lower bound for the amplitude to be estimated

  • amplitude_max (float) – upper bound for the amplitude to be estimated

property shifted_oracle

creating shifted_oracle property

srqae(epsilon: float = 0.01, gamma: float = 0.05, user_shots: int = 100, ratio: float = 2.0)

This function implements the first step of the RQAE paper. The result is an estimation of the desired amplitude with precision epsilon and accuracy gamma.

Parameters:
  • ratio (int) – amplification ratio

  • epsilon (int) – precision

  • gamma (float) – accuracy

  • shots (int) – shots

Returns:

  • amplitude_min (float) – lower bound for the amplitude to be estimated

  • amplitude_max (float) – upper bound for the amplitude to be estimated

property target

creating target property