mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
added Reed Muller rule construction
This commit is contained in:
parent
46153c59b2
commit
709bbbded0
1 changed files with 21 additions and 0 deletions
|
|
@ -36,5 +36,26 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <int MAX_M>
|
||||||
|
class ReedMullerSequence
|
||||||
|
{
|
||||||
|
MergeSort<int, 1<<MAX_M> sort;
|
||||||
|
public:
|
||||||
|
void operator()(int *sequence, int level)
|
||||||
|
{
|
||||||
|
assert(level <= MAX_M);
|
||||||
|
int length = 1 << level;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
sequence[i] = i;
|
||||||
|
sort(sequence, length, [](int a, int b){
|
||||||
|
int x = __builtin_popcount(a);
|
||||||
|
int y = __builtin_popcount(b);
|
||||||
|
if (x != y)
|
||||||
|
return x < y;
|
||||||
|
return a < b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue