qrisp.grover.diffuser#
- diffuser(*args, permeability=[], is_qfree=False, verify=False, **kwargs)#
Applies the Grover diffuser onto (multiple) QuantumVariables.
- Parameters:
- input_objectQuantumVariable or list[QuantumVariable]
The (list of) QuantumVariables to apply the Grover diffuser on.
- phasefloat or sympy.Symbol, optional
Specifies the phase shift. The default is \(\pi\), i.e. a multi-controlled Z gate.
- state_functionfunction, optional
A Python function preparing the initial state. By default, the function prepares the uniform superposition state.
- refection_indiceslist[int], optional
A list indicating with respect to which variables the reflection is performed. By default, the reflection is performed with respect to all variables in
input_object
.
Examples
We apply the Grover diffuser onto several QuantumChars:
>>> from qrisp import QuantumChar >>> from qrisp.grover import diffuser >>> q_ch_list = [QuantumChar(), QuantumChar(), QuantumChar()] >>> diffuser(q_ch_list) >>> print(q_ch_list[0].qs)
┌────────────┐ q_ch_0.0: ┤0 ├ │ │ q_ch_0.1: ┤1 ├ │ │ q_ch_0.2: ┤2 ├ │ │ q_ch_0.3: ┤3 ├ │ │ q_ch_0.4: ┤4 ├ │ │ q_ch_1.0: ┤5 ├ │ │ q_ch_1.1: ┤6 ├ │ │ q_ch_1.2: ┤7 diffuser ├ │ │ q_ch_1.3: ┤8 ├ │ │ q_ch_1.4: ┤9 ├ │ │ q_ch_2.0: ┤10 ├ │ │ q_ch_2.1: ┤11 ├ │ │ q_ch_2.2: ┤12 ├ │ │ q_ch_2.3: ┤13 ├ │ │ q_ch_2.4: ┤14 ├ └────────────┘