cocsep_selfsim_distribution_tests.c (741B)
1 #include "../test.h" 2 3 size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); 4 5 int bcount(uint64_t x) { 6 int ret; 7 uint64_t i; 8 9 for (i = 0, ret = 0; i < 64; i++) 10 if (x & (UINT64_C(1) << i)) 11 ret++; 12 13 return ret; 14 } 15 16 void run(void) { 17 unsigned char buf[2000000]; 18 int size[65], tot, j; 19 uint64_t i, selfsim[COCSEP_CLASSES], sim; 20 cube_t rep[COCSEP_CLASSES]; 21 22 memset(size, 0, 65 * sizeof(int)); 23 gendata_cocsep(buf, selfsim, rep); 24 25 for (i = 0, tot = 0; i < COCSEP_CLASSES; i++) { 26 sim = selfsim[i]; 27 if (sim >> 1) 28 tot++; 29 size[bcount(sim)]++; 30 } 31 32 printf("%d self-similar positions out of 3393\n", tot); 33 printf("Size\tnumber of groups\n"); 34 for (j = 0; j <= 48; j++) 35 if (size[j] != 0) 36 printf("%d\t%d\n", j, size[j]); 37 }