Commits

Jeffrino committed 1ad933f

changes made

Comments (0)

Files changed (2)

 		// (floored to make it integral).
 		while(rerun)
 		{
-			for(int i = 0; i < Math.round(Math.PI*Math.sqrt(Math.pow(2,size))*0.25); ++i)
+			for(int i = 0; i < Math.floor(Math.PI*Math.sqrt(Math.pow(2,size))*0.25); ++i)
 			{
 
 				try
 		// Find power of 2 that lies between n^2 and 2*n^2
 		while(q < n*n)
 			q *= 2;
+		// Making inverse discrete quantum fourier transform gate, same size as the register.
+		Gate iqft = new InverseQFT(q);
 
 		//Create an array of complex numbers large enough to represent q in a register
 		entangled = new Complex[(int)Math.pow(2,findRegisterSize(n))];
-
 		// control variables - either we're done or we're taking too long.
 		boolean done = false, fail = false;
 		// Tracking our iterations.
 					entangled[i] = new Complex();
 			inState = new QubitRegister(entangled);
 			inState.normalise();
-
-			// Making inverse discrete quantum fourier transform gate, same size as the register.
-			Gate iqft = new InverseQFT(inState.getLength());
-
+	
 			// This will hopefully transform the register into a particular value...
 			inState = inState.multiply(iqft);