added Reed Muller rule construction

This commit is contained in:
Ahmet Inan 2025-12-29 09:36:29 +01:00
commit 709bbbded0

View file

@ -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;
});
}
};
}