Content deleted Content added
Improve refs. Tighten up some whitespace for better formatting. |
|||
(26 intermediate revisions by 19 users not shown) | |||
Line 1:
{{Short description|Algorithm on linear-feedback shift registers}}
{{distinguish|Berlekamp's algorithm}}
[[File:Berlekamp–Massey algorithm.png|thumb|right|Berlekamp–Massey algorithm]]
The '''Berlekamp–Massey algorithm''' is an [[algorithm]] that will find the shortest [[linear
[[Elwyn Berlekamp]] invented an algorithm for decoding [[BCH code|Bose–Chaudhuri–Hocquenghem (BCH) codes]].<ref>{{Citation
|last= Berlekamp
|first= Elwyn R.
|
|title= Nonbinary BCH decoding
|year= 1967
Line 12 ⟶ 14:
|last= Berlekamp
|first= Elwyn R.
|
|title=Algebraic Coding Theory
|place=Laguna Hills, CA
|
|year=1984
|edition= Revised
Line 22 ⟶ 24:
|first= J. L.
|last= Massey
|
|title= Shift-register synthesis and BCH decoding
|journal= IEEE
|volume= IT-15
|issue= 1
Line 31 ⟶ 33:
|url= http://crypto.stanford.edu/~mironov/cs359/massey.pdf
|doi= 10.1109/TIT.1969.1054260
|s2cid= 9003708
}}</ref><ref>{{Citation
|
|
|last2= Diaz-Toca
|first2= Gema M.
Line 40 ⟶ 43:
|title= The Berlekamp–Massey Algorithm revisited
|journal= Applicable Algebra in Engineering, Communication and Computing
|
|citeseerx=10.1.1.96.2743
|url= http://hlombardi.free.fr/publis/ABMAvar.html
|doi= 10.1007/s00200-005-0190-z
|arxiv= 2211.11721
}}</ref> Massey termed the algorithm the LFSR Synthesis Algorithm (Berlekamp Iterative Algorithm),<ref>{{Harvnb|Massey|1969|p=124}}</ref> but it is now known as the Berlekamp–Massey algorithm.▼
|s2cid= 14944277
▲ }}</ref> Massey termed the algorithm the LFSR Synthesis Algorithm (Berlekamp Iterative Algorithm),<ref>{{Harvnb|Massey|1969|p=124}}</ref> but it is now known as the Berlekamp–Massey algorithm.
==Description of algorithm==
Line 85 ⟶ 90:
:<math> d = d - (d/b)b = d - d = 0.</math>
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 the 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.
==
The algorithm from {{Harvtxt|Massey|1969|p=124}} for an arbitrary field:
<!-- Notes: notation changes from Massey:
Massey Here
Line 100 ⟶ 104:
T(D) T(x) polynomial
-->
<div class="mw-highlight mw-highlight-lang-c mw-content-ltr">
polynomial(field ''K'') s(x) = ... <span class="cm">/* coeffs are
<span class="cm">/* connection polynomial */</span>
polynomial(field K) C(x) = 1; <span class="cm">/* coeffs are
polynomial(field K) B(x) = 1;
int L = 0;
int m = 1;
field K b = 1;
int n;
<span class="cm">/* steps 2. and 6. */</span>▼
<span class="k">for</span> (n = 0; n < N; n++) {▼
▲ /* steps 2. and 6. */
<span class="cm">/* step 2. calculate discrepancy */</span>▼
▲ for (n = 0; n < N; n++) {
field K d = s<sub>n</sub> + {{math|∑{{su|p=L|b=i=1}} c<sub>i</sub> s<sub>n - i</sub>}} <!--Σi=1Lci⋅sn−i;-->
▲ /* step 2. calculate discrepancy */
<span class="k">if</span> (d == 0) {▼
<span class="cm">/* step 3. discrepancy is zero; annihilation continues */</span>
▲ if (d == 0) {
} <span class="k">else</span> <span class="k">if</span> (2 * L <= n) {
m = m + 1;▼
<span class="cm">/*
C(x) = C(x) - d b<sup>−1</sup> x<sup>m</sup> B(x);
} <span
<span class="cm">/* step 4. */</span>▼
} else {▼
C(x) = C(x) - d b<sup>−1</sup> x<sup>m</sup> B(x);
▲ /* step 4. */
m = m + 1;▼
}
}
<span class="k">return</span> 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.
{{sxhl|2=c|1=<nowiki/>
/* ... */
for (n = 0; n < N; n++) {
/* if odd step number, discrepancy == 0, no need to calculate it */
if ((n&1) != 0) {
▲ m = m + 1;
/* ... */
}}
==See also==
* [[Reed–Solomon error correction]]
* [[Reeds–Sloane algorithm]], an extension for sequences over integers mod ''n''
* [[Nonlinear-feedback shift register]] (NLFSR)
==References==
Line 164 ⟶ 162:
==External links==
* {{springer|title=Berlekamp-Massey algorithm|id=p/b120140}}
*
* {{MathWorld|urlname=Berlekamp-MasseyAlgorithm|title=Berlekamp–Massey Algorithm}}
* [https://code.google.com/p/lfsr/ GF(2) implementation in Mathematica]
* {{
* [https://berlekamp-massey-algorithm.appspot.com/ Online GF(2) Berlekamp-Massey calculator]
Line 173 ⟶ 171:
[[Category:Error detection and correction]]
[[Category:Cryptanalytic algorithms]]
[[Category:Articles with example code]]
|