#! /bin/sh export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" arg="$1" if [ -z "$arg" ] then arg="def1" fi if [ "$arg" = "def1" -o "$arg" = "def2" ] # default then n=16 eflag="" noise="p" a=-1 b=-1 if [ "$arg" = "def1" ] then p=0.9 nt=100 else # def2 p=0.95 nt=1000 #a=12368 #b=1 fi #unused: #eflag="e" #p=0.5 #nt=100 #noise="ra" title="Bernstein-Vazirani problem, n=$n, $noise=$p" xlabel="trials" ylabel="bits correct" echo "generating BV$eflag-$n-$p.gif" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" ./BV -s$eflag $n $p $a $b $nt > BV$eflag-$n-$p.out grep -v 'BV:' BV$eflag-$n-$p.out | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > BV$eflag-$n-$p.gif else # alternate n=4 a=7 m=$(( (a<<1)|1 )) xlabel="measured value" ylabel="probability" if [ "$arg" = "alt1" ] then eflag="e" plist="0.0 0.2 0.4 0.6" noise="ra" else # alt2 eflag="" plist="0.0 0.5 0.75 1.0" noise="p" fi for p in $plist do echo "generating BV$eflag-$p.gif" title="Bernstein-Vazirani problem, n=$n, $noise=$p, a=$a, m=$m" labels="set yrange [0:1]\nset title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" ./BV -m$eflag $n $p $a 0 > BV$eflag-$p.out grep -v 'BV:' BV$eflag-$p.out | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > BV$eflag-$p.gif done fi