> ## Documentation Index
> Fetch the complete documentation index at: https://prod-mint.classiq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Amplitude Amplification

Functions:

| Name                            | Description                       |
| ------------------------------- | --------------------------------- |
| `amplitude_amplification`       | \[Qmod Classiq-library function]. |
| `exact_amplitude_amplification` | \[Qmod Classiq-library function]. |

### amplitude\_amplification

<pre><code>amplitude\_amplification(
reps: CInt,
oracle: QCallable\[QArray\[QBit]],
space\_transform: QCallable\[QArray\[QBit]],
packed\_qvars: QArray\[QBit]
) -> None</code></pre>

\[Qmod Classiq-library function]

Applies the Amplitude Amplification algorithm; 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_qvars`    | `QArray[QBit]`            |                                                                                                                                                                                       | *required* |

### exact\_amplitude\_amplification

<pre><code>exact\_amplitude\_amplification(
amplitude: CReal,
oracle: QCallable\[QArray\[QBit]],
space\_transform: QCallable\[QArray\[QBit]],
packed\_qvars: QArray\[QBit]
) -> None</code></pre>

\[Qmod Classiq-library function]

Applies an exact version of the Amplitude Amplification algorithm, 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](https://arxiv.org/abs/2210.14892).

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_qvars`    | `QArray[QBit]`            |                                                                                                                                                                                       | *required* |
