X-Git-Url: https://s3miclassical.com/gitweb/?p=strong_simulation_stabilizer_rank.git;a=blobdiff_plain;f=strongsim_relerr.c;fp=strongsim_relerr.c;h=0000000000000000000000000000000000000000;hp=24ec5b3843adb178932c3d377dd50ecab787aa99;hb=00f8f5c3f25b6137aec8180d0da144608ae55555;hpb=f36d60f8c85e0879a7d2b52e816638d2b4fdf86a diff --git a/strongsim_relerr.c b/strongsim_relerr.c deleted file mode 100644 index 24ec5b3..0000000 --- a/strongsim_relerr.c +++ /dev/null @@ -1,393 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "matrix.h" -#include "exponentialsum.h" -#include "shrinkstar.h" -#include "extend.h" -#include "measurepauli.h" -#include "innerproduct.h" -#include "randomstabilizerstate.h" - -#define ZEROTHRESHOLD (0.00000001) - -int readPaulicoeffs(int *omega, int *alpha, int *beta, int *gamma, int *delta, int numqubits); - -// order of matrix elements is [row][column]!!! - -int main(int argc, char *argv[]) -{ - - if(argc != 2) { - printf("strongsim3_rellerr argument: \"number of stabilizer state samples\"\n"); - exit(0); - } - - int NUMSTABSTATESAMPLES = atoi(argv[1]); // number of stabilizer state samples - - int N; // number of qubits - scanf("%d", &N); - - if(N%3 != 0) { - printf("'N' needs to be a multiple of 3 for a k=3 tensor factor decomposition!\n"); - return 1; - } - - int T; // 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) - scanf("%d", &T); - - int omega[N]; // max of N measurements - int alpha[N][N], beta[N][N], gamma[N][N], delta[N][N]; // max of N measurements of N Paulis - int Paulicounter = 0; - - int i, j, k, l, m; - - FILE *fp; - char buff[255]; - - srand((unsigned)time(NULL)); // seeding the random number generator for randomstabilizerstate() - - fp = fopen("Pd.txt", "r"); - - if(fscanf(fp, "%s", buff) == EOF) { - printf("Error: Pd.txt should start with the number N of P(d) of values tabulated."); - return 1; - } - - double** Pd; - - int PdN = atoi(buff); - - Pd = calloc(PdN, sizeof(double*)); - for(i=0; i 0) { - J[j] = calloc(K[j], sizeof(int*)); D[j] = calloc(K[j], sizeof(int)); - for(k=0; k N) { - printf("Error: Number of Paulis is greater than N!\n"); - return 1; - } - - // Let's break up the Ys into Xs and Zs in the order Z X, as required to pass to measurepauli() - // Y_i = -I*Z*X - for(i=0; i0) - printf("%.10lf %c %.10lf I\n", cabs(creal(amplitude)), cimag(amplitude+ZEROTHRESHOLD)>0?'+':'-' , cabs(cimag(amplitude))); - else - printf("%.10lf %c %.10lf I\n", creal(amplitude), cimag(amplitude+ZEROTHRESHOLD)>0?'+':'-' , cabs(cimag(amplitude))); - - - - for(i=0; i 1) { - printf("Error: Too many coefficients are non-zero at Pauli %d!\n", i); - exit(0); - } - alpha[i] = newalpha; beta[i] = newbeta; gamma[i] = newgamma; delta[i] = newdelta; - } - return 1; - } else - return 0; - -}