#! /bin/sh # # DJ with phase shift error export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" m=7 n=$((m+1)) ylabel="Probability f is constant" arg="$1" if [ "alt" != "$arg" ] # default then title="Deutsch-Jozsa problem, m=$m" xlabel="Number of 1's" labels="set yrange [0:1]\nset title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" rp1="1.2" rp2="1.4" rp3="1.6" outlist="" for rp in $rp1 $rp2 $rp3 do name="DJe-$rp.out" ./DJ -s $n $rp > $name outlist="$outlist $name" done paste $outlist | tail -n +2 > DJe-tmp.out printf "set term gif\nset output\n $labels\nset key bottom right\n\ set style line 1 lc rgb 'blue'\n\ set style line 2 lc rgb 'green'\n\ set style line 3 lc rgb 'red'\n\ plot \ 'DJe-tmp.out' using 5:6 with lines title \"rp=$rp3\",\ 'DJe-tmp.out' using 3:4 with lines title \"rp=$rp2\",\ 'DJe-tmp.out' using 1:2 with lines title \"rp=$rp1\",\ \n" | gnuplot > DJe3.gif rm DJe-tmp.out else # alternate title="Deutsch-Jozsa problem, m=$m, balanced parity function" xlabel="relative phase shift rp" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" ./DJ -e $n > DJe.out tail -n +2 DJe.out | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > DJe.gif fi