9 #include "randomstabilizerstate_equatorial.h"
11 #define ZEROTHRESHOLD (0.00000001)
13 // Note: Make sure you seed the random number generator before calling this!
14 // i.e. srand((unsigned)time(NULL));
15 void randomstabilizerstate_equatorial(int n, int* k, int** h, int*** G, int*** GBar, int* Q, int** D, int*** J)
17 // vector and matrix pointers should all be passed unallocated! (no freeing of memory performed)
25 *k = n; // we will get it to be k=n-d by calling shrinkstar d times below
30 *G = calloc(n, sizeof(int*)); *GBar = calloc(n, sizeof(int*));
31 *h = calloc(n, sizeof(int));
34 (*G)[i] = calloc(n, sizeof(int));
35 (*GBar)[i] = calloc(n, sizeof(int));
41 // keep the equatorial states with h=0 since it shouldn't matter if they have equal amplitude across all computational basis states
43 (*h)[i] = 0;//rand()%2;
45 *Q = (rand()%8); // Q \in Z/8Z
47 *D = calloc(*k, sizeof(int));
49 (*D)[i] = (rand()%4)*2; // D_a \in {0, 2, 4, 6}
51 *J = calloc(*k, sizeof(int*));
53 (*J)[i] = calloc(*k, sizeof(int));
54 for(j=(i+1); j<*k; j++)
55 (*J)[i][j] = (rand()%2)*4; // J_{a,b} \in {0, 4} for a!=b
56 (*J)[i][i] = (2*(*D)[i])%8;
59 for(j=(i+1); j<*k; j++) {
60 (*J)[j][i] = (*J)[i][j];