Skip to main content
Functions:
NameDescription
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; 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:
NameTypeDescriptionDefault
repsCIntNumber of repetitions to apply the grover operator on the initial state. Should be determined by the user, according to the calculated amplification.required
oracleQCallable[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_transformQCallable[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_qvarsQArray[QBit]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, 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 ψ=aψ{good}+{1a}ψ{bad}|\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 ψ{good}|\psi_\{good\}\rangle. Note: if the amplitude argument is not exact, the resulting state will not be exactly ψ{good}|\psi_\{good\}\rangle, and there will be additional internal auxilliary of the function that is not released correctly. Parameters:
NameTypeDescriptionDefault
amplitudeCRealThe amplitude of the state ψ{good}\|\psi_\{good\}\rangle with regards to the initial state prepared by space_transform.required
oracleQCallable[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_transformQCallable[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_qvarsQArray[QBit]required