FreshNicky
Newbie level 1
Hey guys, actually I need your help. I got some Berlekamp-Massey algorithm C code. I have been trying to change 2t iteration to t iteration
That means the algorithm have to iterate as much as two times of error correction capability, but I need to reduce that about half of error
correction capability.
All I want to know is explanation about the code and the idea about the method how to reduce iteration number.
You can find C code below. Regard all.
-------------------------------------------------------------------------------------------------------------------------------------
int bm (syndrome, lambda);
int syndrome[2t]; //t is 4. all 't' is same is like this.
int lambda[t+1][2t+1];
{
int b[t+2][2t];
int gamma[2t+1];
int delta[2t+1] = {0};
int delta_pre;
int k[2t+1];
int lambda_temp1, lambda_temp2;
int step3_op;
int i, j;
lambda[0][0] = 1, b[0][0] = 1, k[0] = 0, gamma[0] = 1;
for( i = 0; i < 2t - 1; i++){
for(j = 0;j <= t ; j++) {
if((i-j) >= 0){
gmult(lambda[j], syndrome[i-j], &delta_pre);
gadd(delta, delta_pre, &delta);
}
}
for(j = 0; j <= t; j++){
gmult(gamma, lambda[j], &lambda_temp1);
if(j ==0) gmult(delta, 0, &lambda_temp2);
else gmult(delta, b[j-1], &lambda_temp2);
gadd(lambda_temp1, lambda_temp2, &lambda[j][i+1]);
}
step3_op = (delta !=0) && (k >=0);
gamma[i+1] = step3_op ? delta : gamma;
k[i+1] = step3_op? -(k+1) : (k+1);
b[0][i+1] = step3_op? lambda[0] : 0;
for(j = 1; j <= t ; j++){
b[j][i+1] = step3_op? lambda[j] : b[j-1];
}
}
That means the algorithm have to iterate as much as two times of error correction capability, but I need to reduce that about half of error
correction capability.
All I want to know is explanation about the code and the idea about the method how to reduce iteration number.
You can find C code below. Regard all.
-------------------------------------------------------------------------------------------------------------------------------------
int bm (syndrome, lambda);
int syndrome[2t]; //t is 4. all 't' is same is like this.
int lambda[t+1][2t+1];
{
int b[t+2][2t];
int gamma[2t+1];
int delta[2t+1] = {0};
int delta_pre;
int k[2t+1];
int lambda_temp1, lambda_temp2;
int step3_op;
int i, j;
lambda[0][0] = 1, b[0][0] = 1, k[0] = 0, gamma[0] = 1;
for( i = 0; i < 2t - 1; i++){
for(j = 0;j <= t ; j++) {
if((i-j) >= 0){
gmult(lambda[j], syndrome[i-j], &delta_pre);
gadd(delta, delta_pre, &delta);
}
}
for(j = 0; j <= t; j++){
gmult(gamma, lambda[j], &lambda_temp1);
if(j ==0) gmult(delta, 0, &lambda_temp2);
else gmult(delta, b[j-1], &lambda_temp2);
gadd(lambda_temp1, lambda_temp2, &lambda[j][i+1]);
}
step3_op = (delta !=0) && (k >=0);
gamma[i+1] = step3_op ? delta : gamma;
k[i+1] = step3_op? -(k+1) : (k+1);
b[0][i+1] = step3_op? lambda[0] : 0;
for(j = 1; j <= t ; j++){
b[j][i+1] = step3_op? lambda[j] : b[j-1];
}
}
Last edited: