This algorithm estimates the amount of solutions for a given Grover oracle.
The QuantumVariable on which to evaluate.
The oracle function.
The precision to perform the quantum phase estimation with.
An estimate of the amount of solutions.
Examples
We create an oracle, which performs a simple phase flip on the last qubit.
from qrisp import quantum_counting, z, QuantumVariable def oracle(qv): z(qv[-1])
We expect half of the state-space of the input to be a solution.
For 3 qubits, the state space is \(2^3 = 8\) dimensional.
>>> quantum_counting(QuantumVariable(3), oracle, 3) 3.999999999999999
For 4 qubits, the state space is \(2^4 = 16\) dimensional.
>>> quantum_counting(QuantumVariable(4), oracle, 3) 7.999999999999998
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4