Skip to content

IQAE

iqae

Classes:

Name Description
IQAE

Implementation of Iterative Quantum Amplitude Estimation [1].

IQAE

IQAE(
    state_prep_op: QCallable[
        QArray[QBit, Literal["problem_vars_size"]], QBit
    ],
    problem_vars_size: int,
    constraints: Optional[Constraints] = None,
    preferences: Optional[Preferences] = None,
)

Implementation of Iterative Quantum Amplitude Estimation [1]. Given \(A\) s.t. \(A|0>_n|0> = \sqrt{1-a}|\psi_0>_n|0> + \sqrt{a}|\psi_1>_n|1>\), the algorithm estimates \(a\) by iteratively sampling \(Q^kA\), where \(Q=AS_0A^{\dagger}S_{\psi_0}\), and \(k\) is an integer variable.

For estimating \(a\), The algorithm estimates \(\theta_a\) which is defined by \(a = sin^2(\theta_a)\), so it starts with a confidence interval \((0, \pi/2)\) and narrows down this interval on each iteration according to the sample results.

References

[1]: Grinko, D., Gacon, J., Zoufal, C., & Woerner, S. (2019). Iterative Quantum Amplitude Estimation. arXiv:1912.05559 <https://arxiv.org/abs/1912.05559>.

Methods:

Name Description
get_model

Implement the quantum part of IQAE in terms of the Qmod Model

get_qprog

Create an executable quantum Program for IQAE.

run

Executes IQAE's quantum program with the provided epsilon, alpha, and execution

get_model

get_model() -> SerializedModel

Implement the quantum part of IQAE in terms of the Qmod Model

Args:

Returns:

Name Type Description
SerializedModel str

A serialized model.

get_qprog

get_qprog() -> QuantumProgram

Create an executable quantum Program for IQAE.

Args:

Returns:

Name Type Description
QuantumProgram QuantumProgram

Quantum program. See QuantumProgram.

run

run(
    epsilon: float,
    alpha: float,
    execution_preferences: Optional[
        ExecutionPreferences
    ] = None,
) -> IQAEResult

Executes IQAE's quantum program with the provided epsilon, alpha, and execution preferences. If execution_preferences has been proved, or if it does not contain num_shot, then num_shot is set to 2048.

Parameters:

Name Type Description Default
epsilon float

Target accuracy in therm of \(\theta_a\) e.g \(a = sin^2(\theta_a \pm \epsilon)\) .

required
alpha float

Specifies the confidence level (1 - alpha)

required
execution_preferences Preferences

Preferences for the execution of the model. See ExecutionPreferences (Optional).

None

Returns: IQAEResult (IQAEResult): A result of the IQAE algorithm. See IQAEResult.

iqae_result

Classes:

Name Description
IQAEIterationData

Handles the data storage for a single iteration of the Iterative Quantum Amplitude

IQAEResult

Represents the result of an Iterative Quantum Amplitude Estimation (IQAE)

IQAEIterationData

Bases: BaseModel

Handles the data storage for a single iteration of the Iterative Quantum Amplitude Estimation algorithm.

This class is intended to represent the results and state of a single Grover iteration of the IQAE process.

Attributes:

Name Type Description
grover_iterations int

The iteration number of Grover's algorithm.

sample_results ExecutionDetails

The ExecutionDetails of Grover iteration. See ExecutionDetails.

grover_iterations

grover_iterations: int

sample_results

sample_results: ExecutionDetails

IQAEResult

Bases: VersionedModel, QmodPyObject

Represents the result of an Iterative Quantum Amplitude Estimation (IQAE) process.

This class encapsulates the output of the IQAE algorithm, including the estimated value, confidence interval, intermediate iteration data, and any warnings generated during the computation.

Attributes:

Name Type Description
estimation float

Estimation of the amplitude.

confidence_interval list[float]

The interval in which the amplitude is within, with a probability equal to epsilon.

iterations_data list[IQAEIterationData]

List of IQAEIterationData of each Grover iteration.

warnings list[str]

List of warnings generated during the IQAE process of each Grover iteration.

confidence_interval

confidence_interval: list[float] = Field(
    min_length=2, max_length=2
)

estimation

estimation: float

iterations_data

iterations_data: list[IQAEIterationData]

warnings

warnings: list[str]