mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +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;
|
||||
for (int i = 0; i < N; ++i)
|
||||
cw |= (code[i] < 0) << i;
|
||||
int word = (*this)(cw);
|
||||
// hard decision
|
||||
if (0)
|
||||
return (*this)(cw);
|
||||
int word = 0, best = 0;
|
||||
return word;
|
||||
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 ..
|
||||
if (0) {
|
||||
for (int j = 0; j < N; ++j) {
|
||||
|
|
@ -111,7 +120,7 @@ public:
|
|||
worst[3] = i;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < (1 << num); ++j) {
|
||||
for (int j = 1; j < (1 << num); ++j) {
|
||||
int tmp = 0;
|
||||
for (int i = 0; i < num; ++i)
|
||||
tmp |= ((j>>i)&1) << worst[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue