%This program calculates some values used in %AFGA (Adaptative Fixed-Point Grover's Algorithm), %which is described in the ArXiv paper entitled %"An Adaptive, Fixed-point Version of Grover's Algorithm", %by R.R. Tucci g0_degs = 21.15 %g0 stands for gamma del_lam_degs = 5 num_steps = 70 fi = fopen ("afga.txt", "w", "native"); fprintf(fi, "gamma(degs) = %10.4e\n", g0_degs); fprintf(fi, "del_lam(degs) = %10.4e\n", del_lam_degs); fprintf(fi, "num_steps = %i\n", num_steps); g0 = (pi/180)*g0_degs; del_lam = (pi/180)*del_lam_degs; sg0 = sin(g0); cg0 = cos(g0); slam = sin(del_lam); clam = cos(del_lam); vz = [0;0;1]; vs0 = [sg0;0;cg0]; vs = vs0; vr = afga_rot(vz, -del_lam, vs); g_in = g0; [g_out, alpha] = afga_step(g_in, g0, del_lam); fprintf(fi,"j\tgam_j(degs)\talp_j(degs)\tvr_x\tvr_y\tvr_z\tvs_x\tvs_y\tvs_z\n"); for j=0:num_steps fprintf(fi,"%i\t", j); fprintf(fi,"%10.4e\t", g_in*180/pi); fprintf(fi,"%10.4e\t", alpha*180/pi); fprintf(fi,"%10.4e\t%10.4e\t%10.4e\t", vr(1), vr(2), vr(3)); fprintf(fi,"%10.4e\t%10.4e\t%10.4e\n", vs(1), vs(2), vs(3)); vs = afga_rot(vs0, -alpha, vr); vr = afga_rot(vz, -del_lam, vs); g_in = g_out; [g_out, alpha] = afga_step(g_in, g0, del_lam); endfor fclose(fi);