I am suppose to program autocorrelation test (thiis test tries to determine if a subset of bits is related to another subset from the same string) for function R(j) = ∑n xn XOR xn- however my program doesn't work and I cannot move forward. This is so far I got:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
void printauto(int *bits, int size, int maxj)
{
int x, j, sum;
for (j = 1; j <= maxj; j++) {
for (x = j, sum = 0; x < size; x++) {
sum += (bits[x] ^ bits[x-j]);
}
printf("Lag[%4d] = %5d (expected %5d)\n",
j, sum, (size - j)/2);
}
}
Aucun commentaire:
Enregistrer un commentaire