projects
/
weak_simulation_stab_extent.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update from v0.1 to v1.0
[weak_simulation_stab_extent.git]
/
supplement.c
diff --git
a/supplement.c
b/supplement.c
index f74574c303b7027e7634692d74d7ba2929e1c412..b3a5cbecb6ca44adf7d1e1af2df9278b5c23b0f0 100644
(file)
--- 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
{
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
unsigned long bitstring;
int bitstringCounter = 1; // bitstringCounter starts at 1 since 0 is the given bitstring
+ int bitstringCounterMax = floor(fractionSupplement*T);
int i;
int i;
+ if(bitstringCounter > bitstringCounterMax) return;
+
// first added bitstring is alpha ... alpha for alpha = 01
bitstring = 1;
for(i=1; i<T/2; i++) {
// first added bitstring is alpha ... alpha for alpha = 01
bitstring = 1;
for(i=1; i<T/2; i++) {
@@
-43,6
+46,7
@@
void supplement(long stabStateIndices[], int T)
//printf("%lu\n", bitstring);
stabStateIndices[bitstringCounter] = given^(bitstring);
bitstringCounter++;
//printf("%lu\n", bitstring);
stabStateIndices[bitstringCounter] = given^(bitstring);
bitstringCounter++;
+ if(bitstringCounter > bitstringCounterMax) return;
// second added bitstring is beta ... beta for beta = 10
bitstring = 2;
// 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++;
//printf("%lu\n", bitstring);
stabStateIndices[bitstringCounter] = given^bitstring;
bitstringCounter++;
+ if(bitstringCounter > bitstringCounterMax) return;
maskList[0] = round(pow(2,pow(2,K)))-1;
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++;
//printf("new bitstring=");
//printBinary(stabStateIndices[bitstringCounter], T);
bitstringCounter++;
+ if(bitstringCounter > bitstringCounterMax) return;
}
maskList[treeDepth] = levelMask;
}
maskList[treeDepth] = levelMask;
@@
-97,7
+103,7
@@
int main(int argc, char *argv[])
stabStateIndices[0] = (int)(pow(2,T))-1;
stabStateIndices[0] = (int)(pow(2,T))-1;
- supplement(&stabStateIndices[0], T);
+ supplement(&stabStateIndices[0], T
, 1.0
);
int i;
for(i=0; i<T+1; i++)
int i;
for(i=0; i<T+1; i++)