#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <sys/auxv.h>
// order of matrix elements is [row][column]!!!
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; i<N; i++) {
- r = rand()%4; printf("%d\n",r); // omega
+ r = (rand()%2)*2; printf("%d\n",r); // omega
for(j=0; j<N; j++) {
r = rand()%4;
Pauli[j][qubita] = 3; // X->Y
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
} 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;
}
}
}