Skip to main content
Functions:

phase_oracle

phase_oracle(
predicate: QPerm[Const[QArray[QBit]], QBit],
target: Const[QArray[QBit]]
) -> None
[Qmod Classiq-library function] Creates a phase oracle operator based on a predicate function. Applies a predicate function and marks “good” and “bad” states with a phase flip. If the predicate is marked as χ\chi, and the oracle is marked as S{χ}S_\{\chi\}, then: Sχx={xif χ(x)=1xif χ(x)=0S_{\chi}\lvert x \rangle = \begin{cases} -\lvert x \rangle & \text{if } \chi(x) = 1 \\ \phantom{-} \lvert x \rangle & \text{if } \chi(x) = 0 \end{cases} Parameters:

reflect_about_zero

reflect_about_zero(
qvar: Const[QArray[QBit]]
) -> None
[Qmod Classiq-library function] Reflects the state about the |0> state (i.e. applies a (-1) phase to all states besides the |0> state). Implements the operator S0S_0: S0x=(1)(x0)x=(200I)x\begin{equation} S_0|{x}\rangle = (-1)^{(x\ne0)}|{x}\rangle= (2|{0}\rangle\langle{0}|-I)|{x}\rangle \end{equation} Parameters:

grover_diffuser

grover_diffuser(
space_transform: QCallable[QArray[QBit]],
packed_vars: QArray[QBit]
) -> None
[Qmod Classiq-library function] Reflects the given state about the A|0> state, where A is the space_transform parameter. It is defined as: D=AS0A\begin{equation} D = A S_0 A^{\dagger} \end{equation} where S0S_0 is the reflection about the |0> state (see reflect_about_zero). Parameters:

grover_operator

grover_operator(
oracle: QCallable[QArray[QBit]],
space_transform: QCallable[QArray[QBit]],
packed_vars: QArray[QBit]
) -> None
[Qmod Classiq-library function] Applies the grover operator, defined by: Q=Sψ0Sψ1Q=S_{\psi_0}S_{\psi_1} where S{ψ1}S_\{\psi_1\} is a reflection about the non-marked states, and S{ψ0}S_\{\psi_0\} is a reflection about a given state defined by ψ0=A0|\psi_0\rangle = A|0\rangle. Parameters:
grover_search(
reps: CInt,
oracle: QCallable[QArray[QBit]],
packed_vars: QArray[QBit]
) -> None
[Qmod Classiq-library function] Applies Grover search algorithm. Parameters: