Skip to content

Amplitude amplification

amplitude_amplification

Functions:

Name Description
amplitude_amplification

[Qmod Classiq-library function]

exact_amplitude_amplification

[Qmod Classiq-library function]

amplitude_amplification

amplitude_amplification(
    reps: CInt,
    oracle: QCallable[QArray[QBit]],
    space_transform: QCallable[QArray[QBit]],
    packed_qvars: QArray[QBit],
) -> None

[Qmod Classiq-library function]

Applies the Amplitude Amplification algorithm (QAE); Prepares a state using the given space_transform function, and applies reps repetititions of the grover operator, using the given oracle functions which marks the "good" states.

Parameters:

Name Type Description Default
reps CInt

Number of repetitions to apply the grover operator on the initial state. Should be determined by the user, according to the calculated amplification.

required
oracle QCallable[QArray[QBit]]

The oracle operator that marks the "good" states. This operator should flip the sign of the amplitude of the "good" state.

required
space_transform QCallable[QArray[QBit]]

The space transform operator (which is known also the state preparation operator). First applied to prepare the state before the amplification, then used inside the Grover operator.

required
packed_vars

The variable that holds the state to be amplified. Assumed to be in the zero state at the beginning of the algorithm.

required

exact_amplitude_amplification

exact_amplitude_amplification(
    amplitude: CReal,
    oracle: QCallable[QArray[QBit]],
    space_transform: QCallable[QArray[QBit]],
    packed_qvars: QArray[QBit],
) -> None

[Qmod Classiq-library function]

Applies an exact version of the Amplitude Amplification algorithm (QAE), assuming knowledge of the amplitude of the marked state. The function should be applied on the zero state, and it takes care for preparing the initial state before amplification using the space_transform.

Based on the algorithm in Quantum state preparation without coherent arithmetic.

Assuming the space_transform creates a state \(|\psi\rangle = a|\psi_{good}\rangle + \sqrt{1-a}|\psi_{bad}\rangle\), given a as the amplitude argument, the function will load exactly the state \(|\psi_{good}\rangle\).

Note: if the amplitude argument is not exact, the resulting state will not be exactly \(|\psi_{good}\rangle\), and there will be additional internal auxilliary of the function that is not released correctly.

Parameters:

Name Type Description Default
amplitude CReal

The amplitude of the state \(|\psi_{good}\rangle\) with regards to the initial state prepared by space_transform.

required
oracle QCallable[QArray[QBit]]

The oracle operator that marks the "good" states. This operator should flip the sign of the amplitude of the "good" state.

required
space_transform QCallable[QArray[QBit]]

The space transform operator (which is known also the state preparation operator). First applied to prepare the state before the amplification, then used inside the Grover operator.

required
packed_vars

The variable that holds the state to be amplified. Assumed to be in the zero state at the beginning of the algorithm.

required