From: Lucas K Date: Tue, 22 Dec 2020 22:56:20 +0000 (-0800) Subject: delete specific instances of strongsim.c and strongsim_relerr.c X-Git-Url: https://s3miclassical.com/gitweb/?p=strong_simulation_stabilizer_rank.git;a=commitdiff_plain;h=00f8f5c3f25b6137aec8180d0da144608ae55555 delete specific instances of strongsim.c and strongsim_relerr.c --- diff --git a/strongsim.c b/strongsim.c deleted file mode 100644 index 389a737..0000000 --- a/strongsim.c +++ /dev/null @@ -1,286 +0,0 @@ -#include -#include -#include -#include -#include -#include "matrix.h" -#include "exponentialsum.h" -#include "shrink.h" -#include "extend.h" -#include "measurepauli.h" -#include "innerproduct.h" - -int readPaulicoeffs(int *omega, int *alpha, int *beta, int *gamma, int *delta, int numqubits); - -// order of matrix elements is [row][column]!!! - -int main() -{ - - 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; - int alpha[N], beta[N], gamma[N], delta[N]; - int Paulicounter = 0; - - int i, j, k, l, m; - - double complex coeffa = -0.25*(1.0-I)*(-1.0-I+sqrt(2.0))*csqrt(-I); - double complex coeffb = 0.25*(-1.0-I)*(1.0-I+sqrt(2.0))*csqrt(I); - double complex coeffc = 0.25*(-1.0-I)*(-1.0+I+sqrt(2.0))*csqrt(I); - - int n1 = 3; int k1 = 1; int (*(G1[])) = { (int[]) {1, 1, 1}, (int[]) {0, 1, 0}, (int[]) {0, 0, 1}}; int (*(GBar1[])) = { (int[]) {1, 0, 0}, (int[]) {1, 1, 0}, (int[]) {1, 0, 1}}; int h1[] = {1, 1, 0}; int Q1 = 0; int D1[] = {2}; int (*(J1[])) = { (int[]) {4} }; - int n2 = 3; int k2 = 3; int (*(G2[])) = { (int[]) {1, 0, 0}, (int[]) {0, 1, 0}, (int[]) {0, 0, 1} }; int (*(GBar2[])) = { (int[]) {1, 0, 0}, (int[]) {0, 1, 0}, (int[]) {0, 0, 1} }; int h2[] = {0, 0, 0}; int Q2 = 2; int D2[] = {2, 2, 0}; int (*(J2[])) = { (int[]) {4, 0, 0}, (int[]) {0, 4, 0}, (int[]) {0, 0, 0} }; - int n3 = 3; int k3 = 3; int (*(G3[])) = { (int[]) {1, 0, 0}, (int[]) {0, 1, 0}, (int[]) {0, 0, 1} }; int (*(GBar3[])) = { (int[]) {1, 0, 0}, (int[]) {0, 1, 0}, (int[]) {0, 0, 1} }; int h3[] = {0, 0, 0}; int Q3 = 2; int D3[] = {6, 6, 0}; int (*(J3[])) = { (int[]) {4, 4, 4}, (int[]) {4, 4, 4}, (int[]) {4, 4, 0} }; - - int *K; int ***G; int ***GBar; int **h; int *Q; int **D; int ***J; - double complex Gamma[(int)pow(3,N/3)]; // prefactor in front of resultant state - G = calloc(pow(3,N/3),sizeof(int*)); GBar = calloc(pow(3,N/3),sizeof(int*)); - h = calloc(pow(3,N/3),sizeof(int*)); - - J = calloc(pow(3,N/3),sizeof(int*)); D = calloc(pow(3,N/3),sizeof(int*)); Q = calloc(pow(3,N/3),sizeof(int)); - - K = calloc(pow(3,N/3), sizeof(int)); - - double complex origGamma[(int)pow(3,N/3)]; - int *origK, *origQ, **origD, ***origJ; - int ***origG, ***origGBar, **origh; - - origG = calloc(pow(3,N/3),sizeof(int*)); origGBar = calloc(pow(3,N/3),sizeof(int*)); - origh = calloc(pow(3,N/3),sizeof(int*)); - - origJ = calloc(pow(3,N/3),sizeof(int*)); origD = calloc(pow(3,N/3),sizeof(int*)); origQ = calloc(pow(3,N/3),sizeof(int)); - - origK = calloc(pow(3,N/3), sizeof(int)); - - int combination; // a particular combination from the linear combo of stabilizer states making up the tensor factors multiplied together - - - for(j=0; j 0) { - J[j] = calloc(K[j], sizeof(int*)); D[j] = calloc(K[j], sizeof(int)); - for(k=0; k 0) { - origJ[j] = calloc(K[j], sizeof(int*)); origD[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("%lf %c %lf I\n", cabs(creal(amplitude)), cimag(amplitude+0.00000001)>0?'+':'-' , cabs(cimag(amplitude))); - else - printf("%lf %c %lf I\n", creal(amplitude), cimag(amplitude+0.00000001)>0?'+':'-' , cabs(cimag(amplitude))); - //printf("%lf %c %lf I\n", creal(amplitude), cimag(amplitude)>0?'+':'-' , cabs(cimag(amplitude))); - - return 0; - -} - - - -int readPaulicoeffs(int *omega, int *alpha, int *beta, int *gamma, int *delta, int numqubits) -{ - - int newomega, newalpha, newbeta, newgamma, newdelta; - int i; - - if(scanf("%d", &newomega) != EOF) { - *omega = newomega; - 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; - -} 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; - -}