qrisp.quantum_backtracking.QuantumBacktrackingTree.qstep_diffuser#
- QuantumBacktrackingTree.qstep_diffuser(**kwargs)#
Performs the operators \(R_A\) or \(R_B\). For more information on these operators check the paper.
- Parameters
- evenbool
If set to
True
\(R_A\) will be performed. Otherwise \(R_B\) will be performed. Note that “even” refers to the oddity of the h attribute (instead of the distance from the root).- ctrlList[Qubit], optional
A list of qubits that allows performant controlling. The default is [].
Examples
We set up a QuantumBackTrackingTree and perform the diffuser on a marked node
from qrisp import auto_uncompute, QuantumBool, QuantumFloat from qrisp.quantum_backtracking import QuantumBacktrackingTree @auto_uncompute def reject(tree): return QuantumBool() @auto_uncompute def accept(tree): return (tree.h == 1) tree = QuantumBacktrackingTree(3, QuantumFloat( 1, name = "branch_qf*"), accept, reject) tree.init_node([1,1])
>>> print(tree.qs.statevector()) |0>*|1>**3 >>> tree.qstep_diffuser(even = False) >>> print(tree.qs.statevector()) |0>*|1>**3
We see that the node (as expected) is invariant under \(R_A\).