#! /bin/sh # # Due to randomness in the measurement step, # results can vary for the same input parameters export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" N=33 L=11 y=5 # N=143 # 11*13 # L=15 # y=12 # period 2 # y=22 # period 3 # y=21 # period 4 # y=14 # period 5 # y=7 # period 60 case "$#" in 1) y="$1";; 2) L="$1"; y="$2";; 3) N="$1"; L="$2"; y="$3";; esac echo "N = $N, L = $L, y = $y" 1>&2 title="Shor's Algorithm, N=$N, L=$L, y=$y" xlabel="State Index" ylabel="Probability" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" ./Shor $N $L $y > Shor.$N.$y.out sed -e '1,/^FFT/d' -e '/^Peaks/,$d' Shor.$N.$y.out | (printf "set term gif\nset output\n $labels\n plot '-' notitle with linespoints\n"; cat) | gnuplot > Shor.$N.$y.gif