relax range requirement for soft inputs to full range

This commit is contained in:
Ahmet Inan 2020-08-07 08:13:08 +02:00
commit 671b2f22ce
2 changed files with 5 additions and 3 deletions

6
osd.hh
View file

@ -172,14 +172,16 @@ public:
{ {
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
perm[i] = i; perm[i] = i;
std::sort(perm, perm+N, [soft](int a, int b){ return std::abs(soft[a]) > std::abs(soft[b]); }); for (int i = 0; i < N; ++i)
softperm[i] = std::abs(std::max<int8_t>(soft[i], -127));
std::sort(perm, perm+N, [this](int a, int b){ return softperm[a] > softperm[b]; });
for (int j = 0; j < K; ++j) for (int j = 0; j < K; ++j)
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
G[W*j+i] = genmat[N*j+perm[i]]; G[W*j+i] = genmat[N*j+perm[i]];
row_echelon(); row_echelon();
systematic(); systematic();
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
softperm[i] = soft[perm[i]]; softperm[i] = std::max<int8_t>(soft[perm[i]], -127);
for (int i = N; i < W; ++i) for (int i = N; i < W; ++i)
softperm[i] = 0; softperm[i] = 0;
for (int i = 0; i < K; ++i) for (int i = 0; i < K; ++i)

View file

@ -111,7 +111,7 @@ int main()
double DIST = 2; // BPSK double DIST = 2; // BPSK
double fact = DIST / (sigma_noise * sigma_noise); double fact = DIST / (sigma_noise * sigma_noise);
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
noisy[i] = std::min<double>(std::max<double>(std::nearbyint(fact * symb[i]), -127), 127); noisy[i] = std::min<double>(std::max<double>(std::nearbyint(fact * symb[i]), -128), 127);
bool unique = osddec(decoded, noisy, genmat); bool unique = osddec(decoded, noisy, genmat);