3-pure-qubit Grover's iteration

The first example is 3-pure-qubit Grover's iteration [L.K. Grover, Proc. 28th STOC pp.212-219, quant-ph/9605043 (1996)].
 
Program:
init 0 0 0 1;

10: H(1-4);
20: print Find |010> from the haymow state, (H x H x H)|000>\n;
30: print Initially, Pr(010)=;
40: prob(1 2 3, 0 1 0);

50: 7.times{
##### Grover's iteration #####
51: CN(o1 2 o3, 4);
52: H(1-3);
53: CN(o1 o2 o3, 4);
54: H(1-3);
55: print At this time, Pr(010)=;
56: prob(1 2 3, 0 1 0);
##############################
}
  
  
  
The result from the run of this program:
[akira@localhost silqcs]$ ./qcs examples/Grover.q 
Find |010> from the haymow state, (H x H x H)|000>
Initially, Pr(010)=0.125
At this time, Pr(010)=0.78125
At this time, Pr(010)=0.945312
At this time, Pr(010)=0.330078
At this time, Pr(010)=0.012207
At this time, Pr(010)=0.547974
At this time, Pr(010)=0.999786
At this time, Pr(010)=0.576973


root
2004-11-07