mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
moved ML method to bottom
This commit is contained in:
parent
2be153ca67
commit
e0423da509
1 changed files with 14 additions and 18 deletions
|
|
@ -60,24 +60,6 @@ public:
|
||||||
}
|
}
|
||||||
int operator()(const int8_t *code)
|
int operator()(const int8_t *code)
|
||||||
{
|
{
|
||||||
// maximum likelihood
|
|
||||||
if (0) {
|
|
||||||
int word = 0, best = -1, next = -1;
|
|
||||||
for (int msg = 0; msg < W; ++msg) {
|
|
||||||
int enc = (msg << P) | par[msg];
|
|
||||||
int met = metric(code, enc);
|
|
||||||
if (met > best) {
|
|
||||||
next = best;
|
|
||||||
best = met;
|
|
||||||
word = enc;
|
|
||||||
} else if (met > next) {
|
|
||||||
next = met;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (best == next)
|
|
||||||
return -1;
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
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;
|
||||||
|
|
@ -139,6 +121,20 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// maximum likelihood
|
||||||
|
if (0) {
|
||||||
|
for (int msg = 0; msg < W; ++msg) {
|
||||||
|
int enc = (msg << P) | par[msg];
|
||||||
|
int met = metric(code, enc);
|
||||||
|
if (met > best) {
|
||||||
|
next = best;
|
||||||
|
best = met;
|
||||||
|
word = enc;
|
||||||
|
} else if (word != enc && met > next) {
|
||||||
|
next = met;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (best == next)
|
if (best == next)
|
||||||
return -1;
|
return -1;
|
||||||
return word;
|
return word;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue