/* The weight (of the reverse code) of the transition from given state with the input given */ int Convolutional_Code::weight_reverse(const int state, const int input) { int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (input << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; //w += weight_int_table(temp); } return w; }
/* The weight (of the reverse code) of the two paths (input 0 or 1) from given state */ void Convolutional_Code::weight_reverse(const int state, int &w0, int &w1) { int i, j, temp, out, shiftreg = state; w0 = 0; w1 = 0; shiftreg = shiftreg | (1 << m); for (j = 0; j < n; j++) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < m; i++) { out ^= (temp & 1); temp = temp >> 1; } w0 += out; w1 += out ^(temp & 1); } }
int Punctured_Convolutional_Code::weight_reverse(int state, int input, int time) { if (puncture_matrix.size() == 0) { it_error("Punctured_Convolutional_Code::weight_reverse(int, int, int); Set puncturing matrix before."); } int i, j, temp, out, w = 0, shiftreg = state; shiftreg = shiftreg | (int(input) << m); for (j = 0; j < n; j++) { if (puncture_matrix(j, Period - 1 - time) == bin(1)) { out = 0; temp = shiftreg & gen_pol_rev(j); for (i = 0; i < K; i++) { out ^= (temp & 1); temp = temp >> 1; } w += out; } }