6 // order of matrix elements is [row][column]!!!
8 /*********************************************************/
9 /* Generates random Hermitian Paulis that are commuting! */
10 /*********************************************************/
11 int main( int argc, char *argv[])
15 printf("randominputPauli arguments: \"number of qubits\" \"number of T gates\"\n");
19 int N = atoi(argv[1]); // number of qubits
20 int T = atoi(argv[2]); // number of T gate magic states (set to the first 'K' of the 'N' qubits -- the rest are set to the '0' computational basis state)
26 srand((unsigned)time(NULL));
36 Pauli[i][j] = rand()%3; // don't generate Y's (which is represented by '3'; I=0, Z=1, X=2, Y=3)
38 // see if the new Paulis commute with all the previous ones
42 if(Pauli[j][k] != Pauli[i][k] && Pauli[j][k] != 0 && Pauli[i][k] != 0) // if the Paulis are different and neither is equal to the identity then they anticommute
46 i--; // try generating the ith set of Paulis again to get a commuting one
47 break; // break out of the loop over j
50 if(sign == 1) { // found a commuting set!
51 printf("%d\n", (rand()%2)*2); // omega must be 0 or 2 (since it is the power of i: i^omega)
53 printf("%d %d %d %d\n", Pauli[i][j]==0, Pauli[i][j]==1, Pauli[i][j]==2, Pauli[i][j]==3);