aboutsummaryrefslogtreecommitdiff
path: root/test/113_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c
blob: 25cd0b6804a23626bce7ce5ee6e7e041fd5f3a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "../test.h"

size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *);

int bcount(uint64_t x) {
	int ret;
	uint64_t i;

	for (i = 0, ret = 0; i < 64; i++)
		if (x & (UINT64_C(1) << i))
			ret++;

	return ret;
}

void run(void) {
	unsigned char buf[2000000];
	int size[65], tot, j;
	uint64_t i, selfsim[COCSEP_CLASSES], sim;
	cube_t rep[COCSEP_CLASSES];

	memset(size, 0, 65 * sizeof(int));
	gendata_cocsep(buf, selfsim, rep);

	for (i = 0, tot = 0; i < COCSEP_CLASSES; i++) {
		sim = selfsim[i];
		if (sim >> 1)
			tot++;
		size[bcount(sim)]++;
	}

	printf("%d self-similar positions out of 3393\n", tot);
	printf("Size\tnumber of groups\n");
	for (j = 0; j <= 48; j++)
		if (size[j] != 0)
			printf("%d\t%d\n", j, size[j]);
}

Generated with cgit - Back to sebastiano.tronto.net