Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

DatabaseSearch has an incorrect number of iterations and queries #192

Open
MahatKC opened this issue May 21, 2019 · 0 comments
Open

DatabaseSearch has an incorrect number of iterations and queries #192

MahatKC opened this issue May 21, 2019 · 0 comments

Comments

@MahatKC
Copy link

MahatKC commented May 21, 2019

The file Program.cs (Samples/src/DatabaseSearch/Program.cs) has the Number of Iterations wrong in lines 104 and 180.

In both cases, it should be 6.

According to Watrous, page 3, the number of iterations (k) should be equal to pi divided by 4 times the square root of N.

Since, for line 104, N equals 2^6, k should be equal to 6.

For line 180, the equation can be found in Nielsen and Chuang's Quantum Computation and Quantum Information, page 254. It's pi divided by 4 times the square root of N divided by M. Therefore, since 256/4 = 64 = 2^6, k should also be equal to 6.

This small mistake has paramount in the probability analysis of the algorithm. It's a really high probability, that seems to be low as it is.

A related issue is the number of Queries. Considering the sources presented above, each iteration performs a single query to the oracle, which is the most demanding part in terms of resources. Therefore, the number of Queries should be equal to the number of Iterations, but it is implemented as twice the number of Iterations plus one.

Also, the number of attempts done in test is incoherent. It is not an issue per se, but it could be improved. 1000 attempts are done in the classical case, 100 are done in the first quantum case and only 10 are done in the second quantum case. These numbers make sense from a running time point of view, but they allow for inconsistent interpretation of the results. For improved consistency, the same number of attempts should be done in all cases. If the number is 1000, the last quantum case should take a bit longer, but the results are more consistent.

@MahatKC MahatKC changed the title DatabaseSearch has an incorrect number of iterations DatabaseSearch has an incorrect number of iterations and queries May 22, 2019
jwittner pushed a commit to jwittner/Quantum that referenced this issue Dec 16, 2019
@msoeken msoeken self-assigned this Dec 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants