mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
moved initial metric of hard decision to the top
This commit is contained in:
parent
05bd06ec0a
commit
0ebdada99a
1 changed files with 12 additions and 3 deletions
|
|
@ -71,10 +71,19 @@ public:
|
||||||
int cw = 0;
|
int cw = 0;
|
||||||
for (int i = 0; i < N; ++i)
|
for (int i = 0; i < N; ++i)
|
||||||
cw |= (code[i] < 0) << i;
|
cw |= (code[i] < 0) << i;
|
||||||
|
int word = (*this)(cw);
|
||||||
// hard decision
|
// hard decision
|
||||||
if (0)
|
if (0)
|
||||||
return (*this)(cw);
|
return word;
|
||||||
int word = 0, best = 0;
|
int best = 0;
|
||||||
|
// metric of hard decision
|
||||||
|
if (1) {
|
||||||
|
int lol = 8 * sizeof(word) - 1;
|
||||||
|
int sum = 0;
|
||||||
|
for (int i = 0; i < N; ++i)
|
||||||
|
sum += ((word << (lol-i)) >> lol) * code[i];
|
||||||
|
best = sum;
|
||||||
|
}
|
||||||
// flip each bit and see ..
|
// flip each bit and see ..
|
||||||
if (0) {
|
if (0) {
|
||||||
for (int j = 0; j < N; ++j) {
|
for (int j = 0; j < N; ++j) {
|
||||||
|
|
@ -111,7 +120,7 @@ public:
|
||||||
worst[3] = i;
|
worst[3] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int j = 0; j < (1 << num); ++j) {
|
for (int j = 1; j < (1 << num); ++j) {
|
||||||
int tmp = 0;
|
int tmp = 0;
|
||||||
for (int i = 0; i < num; ++i)
|
for (int i = 0; i < num; ++i)
|
||||||
tmp |= ((j>>i)&1) << worst[i];
|
tmp |= ((j>>i)&1) << worst[i];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue