/* zeno.qcl version 0.9 -- show the Quantum Zeno Effect on a qubit. * * Measurements can be done in 3 ways: * * 0 Don't measure at all * 1 Measure the normal way * 2 Measure in accordance with the Church of the Larger Hilbert Space * * The qubit is initialized to |0> and is rotated in nrsteps steps, * with pi/steps radians each. Without measurement, it should be * rotated to |1>. * * Variant 3 will of course take longer time to run since QCL needs to * calculate the entagled state with the environment instead of just * randomly choosing one environment state, but on the plus side the * final dump shows the probability for qubit flipping, which will * decrease if nrsteps is increased. * * Examples: * Rotate from |0> to |1> in 10 steps * qcl zeno.qcl -x 'zeno(0, 10)' * Do the same thing but perform a measurement between each step * qcl zeno.qcl -x 'zeno(1, 10)' * Do the same thing and keep track of the measuring environment * qcl zeno.qcl -x 'zeno(2, 10)' */ /* Copyright (C) 2004-2005 Jörgen Cederlöf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ procedure zeno(int measurehow, int nrsteps) { qureg q[1]; int m; int i; qureg environment[int(measurehow==2) * nrsteps]; /* Zero q and environment */ measure q&environment, m; set(m, q&environment); if (measurehow<0 or measurehow>2) { exit "The first argument must be 0, 1 or 2."; } for i = 0 to nrsteps-1 { dump; if (measurehow == 0) { print "Step", i, "No measurement performed."; } if (measurehow == 1) { measure q, m; print "Step", i, "Measured", m; dump; } if (measurehow == 2) { if (q) { Not(environment[i]); } print "Step", i, "Fanned out internal state to environment."; dump; dump q; } print "Rotating", pi/nrsteps, "radians."; Rot(pi/nrsteps, q); } dump q; measure q, m; print "Final state:", m; dump q; /* Zero q and environment */ measure q&environment, m; set(m, q&environment); }