int qrandom();
/* qrandom(N,r) returns a random number between 0 and (N-1) */
int f();
/* f(r) is an arbitrary binary function that returns 1 only
for a single value of r, for all other values of r it returns 0 */
quantum_main()
{
int i, r;
r = qrandom(N,0);
for(i = 0; i < eta; i++) /* eta is a number of order
N */
{
if (f(r) == 1) invert_phase();
/* f(r) is evaluated within the program itself
this does not need an external observation
(any observation would perturb the system) */
r = qrandom(N,r);
if (r==0) invert_phase();
r = qrandom(N,r);
}
print(r);
}
Figure 3: Quantum program.
Back to Article