This program is a Berlekamp-Massey algorithm demo program.
Install sage. This program is written in sage. Sage is a programming language for mathematicians. Sage is python-based language and has many extensive features for algebra, algebraic geometry and number theory.
Clone demo program's repository.
git clone https://github.com/xenocaliver/BMDecoder.git ./
Run demo program as follows. Regarding BCH code's demo program, run BCHDecoder.sage
.
sage BCHDecoder.sage
Regarding Reed-Solomon code's demo program, run RSDecoder.sage
.
sage RSDecoder.sage
Before discussing Berlekamp-Massey algorithm, we must discuss cyclic codes. We begin crush course for cyclic codes. For persons who want to learn cyclic codes deeply, I recommend coding theory text book e.g. Error Correction Coding: Mathematical Methods and Algorithms. I assume that readers know basic algebra.
Let $ \mathbb{F}{q} $ be a finite field with characteristic $ q $. In coding theory, $ q=2^{M} $ and $ M $ is a natural number. Let $ k $ be a natural number called "dimension". $ m{i}\in\mathbb{F}{q}(i=0,\ldots,k-1) $ and we call $ \boldsymbol{m} = (m{0},\ldots,m_{k-1}) $ a message vector. We express the message as a polynomial
and we call
A transmitter sends
Let
- Find
$\mathbb{F}_{p^{m}}$ which as$n$ primitive$n$ - root of unity$\alpha$ . - Select Non-negative integer
$b$ . - Write down
$2t$ consecutive powers of$\alpha$ :
- Determine minimal polynomial with respect to
$\mathbb{F}_{p}$ of each of powers of$\alpha$ . - generator polynomial
$g(x)$ is Least Common Multiplier of above minimal polynomials.
If
Reed-Solomon codes is $ q $-ary BCH codes whose length equals to $ p^{m} - 1 $.
In
In (1), if
Let
where
Because
Then, we define syndromes as follows:
Let
Let
Consecutive
We construct a polynomial whose roots are inverse of
The polynomial is called error locator polynomial. By contruction,
As per Newton's identities,
Here, we define two important polynomials. We define
Equation
Berlekamp-Massey algorithm is an algorithm to determine error locator polynomial. We illustrate Berlekamp-Massey algorithm according to Chang. The authors slightliy changed original Berlekamp-Massey algorithm in order to design faster decoder circuitry. We implemented code according to Chang. The algorithm is shown as follows:
Initialization
iteration
for
if
else
After
In order to determine error positions, we must find
After finding error locations, we step forward to find correct value. Using Forney's formula, One can find correct value
where
As for BCH codes, it is sufficient to find error position because it is binary. Therefore, BCH decoders do not need Forney's formula.