Berlekamp–Massey algorithm
   HOME

TheInfoList



OR:

The Berlekamp–Massey algorithm is an
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
that will find the shortest
linear-feedback shift register In computing, a linear-feedback shift register (LFSR) is a shift register whose input bit is a linear function of its previous state. The most commonly used linear function of single bits is exclusive-or (XOR). Thus, an LFSR is most often a ...
(LFSR) for a given binary output sequence. The algorithm will also find the minimal polynomial of a linearly recurrent sequence in an arbitrary
field Field may refer to: Expanses of open ground * Field (agriculture), an area of land used for agricultural purposes * Airfield, an aerodrome that lacks the infrastructure of an airport * Battlefield * Lawn, an area of mowed grass * Meadow, a grass ...
. The field requirement means that the Berlekamp–Massey algorithm requires all non-zero elements to have a multiplicative inverse. Reeds and Sloane offer an extension to handle a
ring Ring may refer to: * Ring (jewellery), a round band, usually made of metal, worn as ornamental jewelry * To make a sound with a bell, and the sound made by a bell :(hence) to initiate a telephone connection Arts, entertainment and media Film and ...
.
Elwyn Berlekamp Elwyn Ralph Berlekamp (September 6, 1940 – April 9, 2019) was a professor of mathematics and computer science at the University of California, Berkeley.Contributors, ''IEEE Transactions on Information Theory'' 42, #3 (May 1996), p. 1048. DO10. ...
invented an algorithm for decoding Bose–Chaudhuri–Hocquenghem (BCH) codes.
James Massey James Lee Massey (February 11, 1934 – June 16, 2013) was an American information theorist and cryptographer, Professor Emeritus of Digital Technology at ETH Zurich. His notable work includes the application of the Berlekamp–Massey algorithm ...
recognized its application to linear feedback shift registers and simplified the algorithm. Massey termed the algorithm the LFSR Synthesis Algorithm (Berlekamp Iterative Algorithm), but it is now known as the Berlekamp–Massey algorithm.


Description of algorithm

The Berlekamp–Massey algorithm is an alternative to the Reed–Solomon Peterson decoder for solving the set of linear equations. It can be summarized as finding the coefficients Λ''j'' of a polynomial Λ(''x'') so that for all positions ''i'' in an input stream ''S'': : S_ + \Lambda_1 S_ + \cdots + \Lambda_ S_ + \Lambda_\nu S_i = 0. In the code examples below, ''C''(''x'') is a potential instance of ''Λ''(''x''). The error locator polynomial ''C''(''x'') for ''L'' errors is defined as: : C(x) = C_L x^L + C_ x^ + \cdots + C_2 x^2 + C_1 x + 1 or reversed: : C(x) = 1 + C_1 x + C_2 x^2 + \cdots + C_ x^ + C_L x^L. The goal of the algorithm is to determine the minimal degree ''L'' and ''C''(''x'') which results in all syndromes : S_n + C_1 S_ + \cdots + C_L S_ being equal to 0: : S_n + C_1 S_ + \cdots + C_L S_ = 0,\qquad L\le n\le N-1. Algorithm: ''C''(''x'') is initialized to 1, ''L'' is the current number of assumed errors, and initialized to zero. ''N'' is the total number of syndromes. ''n'' is used as the main iterator and to index the syndromes from 0 to ''N''−1. ''B''(''x'') is a copy of the last ''C''(''x'') since ''L'' was updated and initialized to 1. ''b'' is a copy of the last discrepancy ''d'' (explained below) since ''L'' was updated and initialized to 1. ''m'' is the number of iterations since ''L'', ''B''(''x''), and ''b'' were updated and initialized to 1. Each iteration of the algorithm calculates a discrepancy ''d''. At iteration ''k'' this would be: : d \gets S_k + C_1 S_ + \cdots + C_L S_. If ''d'' is zero, the algorithm assumes that ''C''(''x'') and ''L'' are correct for the moment, increments ''m'', and continues. If ''d'' is not zero, the algorithm adjusts ''C''(''x'') so that a recalculation of ''d'' would be zero: :C(x) \gets C(x) - (d / b) x^m B(x). The ''xm'' term ''shifts'' B(x) so it follows the syndromes corresponding to ''b''. If the previous update of ''L'' occurred on iteration ''j'', then ''m'' = ''k'' − ''j'', and a recalculated discrepancy would be: : d \gets S_k + C_1 S_ + \cdots - (d/b) (S_j + B_1 S_ + \cdots ). This would change a recalculated discrepancy to: : d = d - (d/b)b = d - d = 0. The algorithm also needs to increase ''L'' (number of errors) as needed. If ''L'' equals the actual number of errors, then during the iteration process, the discrepancies will become zero before ''n'' becomes greater than or equal to 2''L''. Otherwise ''L'' is updated and algorithm will update ''B''(''x''), ''b'', increase ''L'', and reset ''m'' = 1. The formula ''L'' = (''n'' + 1 − ''L'') limits ''L'' to the number of available syndromes used to calculate discrepancies, and also handles the case where ''L'' increases by more than 1.


Code sample

The algorithm from for an arbitrary field: polynomial(field K) s(x) = ... /* coeffs are s_j; output sequence as N-1 degree polynomial) */ /* connection polynomial */ polynomial(field K) C(x) = 1; /* coeffs are c_j */ polynomial(field K) B(x) = 1; int L = 0; int m = 1; field K b = 1; int n; /* steps 2. and 6. */ for (n = 0; n < N; n++) return L; In the case of binary GF(2) BCH code, the discrepancy d will be zero on all odd steps, so a check can be added to avoid calculating it. /* ... */ for (n = 0; n < N; n++) { /* if odd step number, discrepancy

0, no need to calculate it */ if ((n&1) != 0) { m = m + 1; continue; } /* ... */


See also

* Reed–Solomon error correction * Reeds–Sloane algorithm, an extension for sequences over integers mod ''n'' * Nonlinear-feedback shift register (NLFSR)


References


External links

*
Berlekamp–Massey algorithm
at
PlanetMath PlanetMath is a free, collaborative, mathematics online encyclopedia. The emphasis is on rigour, openness, pedagogy, real-time content, interlinked content, and also community of about 24,000 people with various maths interests. Intended to be c ...
. *
GF(2) implementation in Mathematica
*


Online GF(2) Berlekamp-Massey calculator
{{DEFAULTSORT:Berlekamp-Massey Algorithm Error detection and correction Cryptanalytic algorithms Articles with example code