From: Lucas K Date: Wed, 17 Mar 2021 23:15:51 +0000 (-0700) Subject: fixed phases of random Pauli input generators X-Git-Url: https://s3miclassical.com/gitweb/?a=commitdiff_plain;h=515e5dd387898880a3477d5d02ddfac55ba2c5f1;p=strong_simulation_stabilizer_rank.git fixed phases of random Pauli input generators --- diff --git a/randominputPauli.c b/randominputPauli.c index da17abe..ee919d6 100644 --- a/randominputPauli.c +++ b/randominputPauli.c @@ -1,6 +1,7 @@ #include #include #include +#include // order of matrix elements is [row][column]!!! @@ -19,14 +20,17 @@ int main( int argc, char *argv[]) printf("%d\n", T); int r; - srand((unsigned)time(NULL)); + unsigned int *seed; + + seed = (unsigned int *)getauxval(AT_RANDOM); + srand(*seed); int i, j; for(i=0; iY else if(Pauli[j][qubita] == 3) { Pauli[j][qubita] = 2; // Y->-X - omega[j] = (2*omega[j])%2; + omega[j] = (2+omega[j])%4; } } } else { // CNOT @@ -89,11 +89,11 @@ int main( int argc, char *argv[]) } else if((Pauli[j][qubita] == 3) && (Pauli[j][qubitb] == 2)) {// YX ->-ZY Pauli[j][qubita] == 1; Pauli[j][qubitb] == 3; - omega[j] = -omega[j]; + omega[j] = (2+omega[j])%4; } else if((Pauli[j][qubita] == 1) && (Pauli[j][qubitb] == 3)) {// ZY ->-YX Pauli[j][qubita] == 3; Pauli[j][qubitb] == 2; - omega[j] = -omega[j]; + omega[j] = (2+omega[j])%4; } } }