mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
use merge sort
This commit is contained in:
parent
389fcc3bd8
commit
ba688ab23b
3 changed files with 5 additions and 4 deletions
7
osd.hh
7
osd.hh
|
|
@ -8,6 +8,7 @@ Copyright 2020 Ahmet Inan <inan@aicodix.de>
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include "bitman.hh"
|
#include "bitman.hh"
|
||||||
|
#include "sort.hh"
|
||||||
|
|
||||||
namespace CODE {
|
namespace CODE {
|
||||||
|
|
||||||
|
|
@ -104,6 +105,7 @@ class OrderedStatisticsDecoder
|
||||||
int8_t codeword[W], candidate[W];
|
int8_t codeword[W], candidate[W];
|
||||||
int8_t softperm[W];
|
int8_t softperm[W];
|
||||||
int16_t perm[W];
|
int16_t perm[W];
|
||||||
|
MergeSort<int16_t, N> sort;
|
||||||
void row_echelon()
|
void row_echelon()
|
||||||
{
|
{
|
||||||
for (int k = 0; k < K; ++k) {
|
for (int k = 0; k < K; ++k) {
|
||||||
|
|
@ -173,7 +175,7 @@ public:
|
||||||
perm[i] = i;
|
perm[i] = i;
|
||||||
for (int i = 0; i < N; ++i)
|
for (int i = 0; i < N; ++i)
|
||||||
softperm[i] = std::abs(std::max<int8_t>(soft[i], -127));
|
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]; });
|
sort(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]];
|
||||||
|
|
@ -247,6 +249,7 @@ class OrderedStatisticsListDecoder
|
||||||
int8_t softperm[W];
|
int8_t softperm[W];
|
||||||
int16_t perm[W];
|
int16_t perm[W];
|
||||||
int score[L], cperm[L];
|
int score[L], cperm[L];
|
||||||
|
MergeSort<int16_t, N> sort;
|
||||||
void row_echelon()
|
void row_echelon()
|
||||||
{
|
{
|
||||||
for (int k = 0; k < K; ++k) {
|
for (int k = 0; k < K; ++k) {
|
||||||
|
|
@ -332,7 +335,7 @@ public:
|
||||||
perm[i] = i;
|
perm[i] = i;
|
||||||
for (int i = 0; i < N; ++i)
|
for (int i = 0; i < N; ++i)
|
||||||
softperm[i] = std::abs(std::max<int8_t>(soft[i], -127));
|
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]; });
|
sort(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]];
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ Copyright 2020 Ahmet Inan <inan@aicodix.de>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "osd.hh"
|
#include "osd.hh"
|
||||||
#include "galois_field.hh"
|
#include "galois_field.hh"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ Copyright 2024 Ahmet Inan <inan@aicodix.de>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "osd.hh"
|
#include "osd.hh"
|
||||||
#include "galois_field.hh"
|
#include "galois_field.hh"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue