From 65413861ba4ad4d6418298f0c42f9809fc1bb1d0 Mon Sep 17 00:00:00 2001 From: Lucas K Date: Wed, 17 Mar 2021 16:18:31 -0700 Subject: [PATCH] deleted incorrect var numPaulis and replaced with numrandomsteps in test2 bash script --- test2.bash | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test2.bash b/test2.bash index e6b3122..b70099c 100644 --- a/test2.bash +++ b/test2.bash @@ -6,9 +6,8 @@ # e.g. if you test gausssums_multipleof6 then numqubits=6*n for some integer n numqubits=6 numTgates=6 -# choose the number of commuting Pauli measurements you want to generate in each run -# (note: can't be greater than $numqubits) -numPaulis=6 + +numrandomsteps=1000000 #10000 # number of random steps when generating Paulis # number of random stabilizer states to use for stochastic sampling numsamples=1000 @@ -16,14 +15,14 @@ numsamples=1000 # since this is a stochastic calculation, we need a threshold to determine when the calculation is withing close enough relative error threshold=0.005 # absolute value threshold difference between computed and exact value -numruns=20 +numruns=100 echo "Starting test of $numruns random $numqubits-Pauli expectation values calculated by averaging $numsamples random stabilizer states and comparing to threshold $threshold..." for i in $(seq 1 $numruns) do # sleep for 1 second for the pseudorandom number generator -sleep 1; a=$(stdbuf -oL ./randominputcommutingHermitianPauli2 $numqubits $numTgates $numPaulis > inputPauli.txt && ./strongsim_relerr $numsamples < inputPauli.txt | tail -1) +sleep 1; a=$(stdbuf -oL ./randominputcommutingHermitianPauli2 $numqubits $numTgates $numrandomsteps > inputPauli.txt && ./strongsim_relerr $numsamples < inputPauli.txt | tail -1) b=$(stdbuf -oL ./multipauli < inputPauli.txt | tail -n1) are=$(echo "$a" | cut -f 1 -d " " | cut -c 1-5); aim=$(echo "$a" | cut -f 3 -d " " | cut -c 1-5); aimsign=$(echo $a | cut -f 2 -d " "); bimsign=$(echo $b | cut -f 2 -d " "); @@ -33,11 +32,11 @@ rediff=$( printf 'sqrt((%f - %f)^2)\n' "$are" "$bre" | bc -l ) imdiff=$( printf 'sqrt((%f - %f)^2)\n' "$aim" "$bim" | bc -l ) if (( $(echo "$rediff < $threshold" |bc -l) )) && (( $(echo "$imdiff < $threshold" |bc -l) )) then - if (( $(echo "$bim < $threshold" |bc -l) )) || [ "$aimsign" == "$bimsign" ] + if (( $(echo "$bim < $threshold" |bc -l) )) || [ "$aimsign" == "$bimsign" ] then continue else - echo "NOTE EQUAL!" + echo "NOT EQUAL!" exit fi else -- 2.30.2