#! /bin/sh # # Grover with/without depolarizing noise export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" n=16 iter=300 m=1234 xlabel="Number of iterations" ylabel="Probability of match" gif="Grover" for p in 0 0.25 do out="${gif}.out" title="Grover's Search, 2**$n, p=$p, m=$m" labels="set yrange [0:1]\nset title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" ./Grover $n $iter $p $m > "$out" tail -n +2 "$out" | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > "${gif}.gif" gif="${gif}-0.25" done