X-Git-Url: https://s3miclassical.com/gitweb/?p=weak_simulation_stab_extent.git;a=blobdiff_plain;f=supplement.c;h=b3a5cbecb6ca44adf7d1e1af2df9278b5c23b0f0;hp=f74574c303b7027e7634692d74d7ba2929e1c412;hb=7bc25656311c391af6a4d5814cc82080981c63c4;hpb=d914e7c183347b1340988e0869a6e053dd573991 diff --git a/supplement.c b/supplement.c index f74574c..b3a5cbe 100644 --- a/supplement.c +++ b/supplement.c @@ -13,7 +13,7 @@ void printBinary(unsigned long number, int T) { } -void supplement(long stabStateIndices[], int T) +void supplement(long stabStateIndices[], int T, double fractionSupplement) { int K = round(log(T)/log(2)); // T = 2^K @@ -31,9 +31,12 @@ void supplement(long stabStateIndices[], int T) unsigned long bitstring; int bitstringCounter = 1; // bitstringCounter starts at 1 since 0 is the given bitstring + int bitstringCounterMax = floor(fractionSupplement*T); int i; + if(bitstringCounter > bitstringCounterMax) return; + // first added bitstring is alpha ... alpha for alpha = 01 bitstring = 1; for(i=1; i bitstringCounterMax) return; // second added bitstring is beta ... beta for beta = 10 bitstring = 2; @@ -53,6 +57,7 @@ void supplement(long stabStateIndices[], int T) //printf("%lu\n", bitstring); stabStateIndices[bitstringCounter] = given^bitstring; bitstringCounter++; + if(bitstringCounter > bitstringCounterMax) return; maskList[0] = round(pow(2,pow(2,K)))-1; @@ -78,6 +83,7 @@ void supplement(long stabStateIndices[], int T) //printf("new bitstring="); //printBinary(stabStateIndices[bitstringCounter], T); bitstringCounter++; + if(bitstringCounter > bitstringCounterMax) return; } maskList[treeDepth] = levelMask; @@ -97,7 +103,7 @@ int main(int argc, char *argv[]) stabStateIndices[0] = (int)(pow(2,T))-1; - supplement(&stabStateIndices[0], T); + supplement(&stabStateIndices[0], T, 1.0); int i; for(i=0; i