I am attempting to use Grover's to find elements in an array that satisfy a comparative query (=, <, >, etc). I am using Qiskit, and am using a qRAM to encode my array.
I have experimented with several quantum comparators, all of which seem to be working well offline (i.e. they indeed produce 1 when the query is satisfied). I settled for the IntegerComparator
present in Qiskit.
Things start getting weird once I inject my comparator into the oracle of my algorithm. For the array is $[7,6,5,4,3,2,1,0]$, the following happens when testing the query $< n$ for some predetermined $n$:
- The algorithm produces sensible results for $n \in \{0, 1, 2,3\}$.
- For $n = 4$, the algorithm doesn't produce any conclusive solutions.
- For $n \in \{5,6,7\}$, it produces answers the $\geq n$ instead!
Analogous behavior was observed for $> n$. The algorithm works perfectly for the query $==n$.
I have been debugging this for several days, and I can't seem to figure it out. I highly appreciate any kind of help.