0

I'm trying to understand https://en.wikipedia.org/wiki/BCH_code#Decoding_examples I'm now having trouble with the row reduction in binary below , with elements from $GF(2^4)$ in binary : $s_1=1011 , _2 = 1001 , _3 = 1011 , _4 = 1101 , s_{5}=0001, s_{6}=1001. $

Next, apply the Peterson procedure by row-reducing the following augmented matrix. ${\displaystyle \left[S_{3\times 3}|C_{3\times 1}\right]={\begin{bmatrix}s_{1}&s_{2}&s_{3}&s_{4}\\s_{2}&s_{3}&s_{4}&s_{5}\\s_{3}&s_{4}&s_{5}&s_{6}\end{bmatrix}}={\begin{bmatrix}1011&1001&1011&1101\\1001&1011&1101&0001\\1011&1101&0001&1001\end{bmatrix}}\Rightarrow {\begin{bmatrix}0001&0000&1000&0111\\0000&0001&1011&0001\\0000&0000&0000&0000\end{bmatrix}}}$

Could someone show me which steps were used (row substitution, addition or multiplication ) to get the all 0 row ?

  • 2
    The Wikipedia description is terrrible to say the least. The row-reduction should be done in GF$(2^4)$ arithmetic, so that when (in the process of Gaussian elimination) you subtract a multiple of the first row from the second, you are subtracting $\frac{s_2}{s_1}[s_1 \quad s_2\quad s_3\quad s_4] = [s_2\quad \cdots ] $ from $[s_2\quad s_3\quad s_4\quad s_5]$ where that computation is done in GF$(2^4)$ and not with 4-bit vectors. – Dilip Sarwate Jul 26 '24 at 20:35
  • @DilipSarwate - those 4 bit vectors are a shorthand notation for a $GF(2^4)$ elements, $1011 = 1 x^3 + 0 x^2 + 1 x + 1$ . Note that the Peterson (PGZ) decoder has time complexity $O(n^3)$, while Berlekamp Massey and Sugiyama extended Euclidean decoders have time complexity $O(n^2)$. The BCH article doesn't include Berlekamp Massey, but the Reed Solomon article does https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#BCH_view_decoders . – rcgldr Jul 27 '24 at 15:04
  • @rcgldr I fully understand what those 4-bit vectors are, and I stand by my assertion that the Wikipedia description is terrible. The calculations needed go from the $3\times 4$ matrix of the known syndromes to the end result are $GF(2^4)$ calculations and not $GF(2)$ operations on the $3\times 16$ matrix shown to row-reduce it to the final form with with the last row being all zeroes. That last row is 4 zeroes in $GF(2^4)$, not 16 zeroes in $GF(2)$. – Dilip Sarwate Jul 27 '24 at 15:38
  • @DilipSarwate - the Wiki article explains its usage of binary via an example before using those binary values. $x^{9}+x^{4}+x^{2} = $ [ 1 0 0 0 0 1 0 1 0 0 ] . Another case where using binary is helpful is when doing isomorphic mapping from one field to another via a matrix multiply by an n row by n bit matrix, where that multiply is done in $GF(2)$ and not $GF(2^n)$. – rcgldr Jul 27 '24 at 23:09

1 Answers1

1

I am using the discrete logarithm table from my old Q&A pair prepared for referrals like this. What your source calls $\alpha$ is what I call $\gamma$, so for example $$1011=\gamma^3+\gamma+1=\gamma^7,\quad 1001=\gamma^3+1=\gamma^{14},\quad 1101=\gamma^3+\gamma^2+1=\gamma^{13}$ $$ et cetera. My table is always used in the last step. See the comment by @rcgldr under the question for information about how to interpret the bit strings, except that I use $\gamma$ instead of $x$, because I reserve $x$ for an indeterminate (and hence replace it with something else when I move to a quotient field of a polynomial ring).

Anyway, in terms of powers of $\gamma$s the $S$-matrix reads $$ S=\left(\begin{array}{cccc} \gamma^7& \gamma^{14}& \gamma^7&\gamma^{13}\\ \gamma^{14}& \gamma^7&\gamma^{13}&1\\ \gamma^7&\gamma^{13}&1&\gamma^{14} \end{array}\right). $$ So, pivoting the first column, we add the top row multiplied by $\gamma^7$ to the second, and simply also add the top row to the bottom row. This yields (again consult the table) $$ S\to \left(\begin{array}{cccc} \gamma^7& \gamma^{14}& \gamma^7&\gamma^{13}\\ 0& \gamma^{10}&\gamma^{2}&\gamma^{10}\\ 0&\gamma^{2}&\gamma^9&\gamma^{2} \end{array}\right). $$ As $\gamma^{15}=1$ we have $\gamma^2=\gamma^{17}$, and can immediately tell that the bottom row is gotten from the second when divided by $\gamma^8$. In other words, the two last rows are scalar multiples of each other, and the row reduction step produces an all zeros row when pivoting the second column.

Jyrki Lahtonen
  • 140,891
  • One issue with using $\gamma$ is cases where knowing if a sum = 0 is needed. For example in $GF(2^4)$, while it is obvious that $\gamma^7+\gamma^7 = 0$, it won't be obvious that $\gamma^4+\gamma^9+\gamma^{14} = 0$, but if using binary representation, it would be obvious. Another situation where using binary is better would be isomorphic mapping of $GF(2^n)$ to another field using a $n$ row by $n$ bit column matrix, where the multiply is done in $GF(2)$ and not $GF(2^n$). – rcgldr Jul 29 '24 at 07:08
  • Point taken @rcgldr. My reasons for sticking to $\gamma,\beta,\alpha$,whatnot are, in addition to 0) personal inertia, 1) having a reminder about the underlying multiplication rules (totally hidden when using bit strings), 2) avoiding the use of $x$, bound to lead to confusion, 3) making it easier to distuingish elements of $GF(2^n)$ from those of $GF(2^m)$, $m\neq n$, where bitstrings make some users think that, e.g. zero padding does not change the element, and 4) in the case of "small" fields (say up to $2^{14}$) my own implementations use discrete logarithm tables exclusively. – Jyrki Lahtonen Jul 29 '24 at 09:01
  • (cont'd) Of course, in some contexts item 3 is not pressing, and item 4 is not relevant either for larger fields. All depending :-) – Jyrki Lahtonen Jul 29 '24 at 09:02
  • If storing values as powers of $\gamma$, wouldn't addition tables also be needed, and wouldn't these be $2^n$ by $2^n$? If values are stored in binary, addition or subtraction is just XOR, and multiplication would involve 2 log table lookups, 1 ADD, then 1 exp table lookup. On systems with carryless multiply, such as PCLMULQDQ on X86, then $GF(2^n)$ multiply is implemented with 3 carryless multiplies and 1 XOR, for $n$ up to 64. Hardware implementations are almost always binary. – rcgldr Jul 29 '24 at 16:10
  • @rcgldr My implementations used (past tense, talking the last years of DOS era here) a discrete log table, and an a inverse table. Storage was binary (or monomial basis form). Exactly to make addition = XOR. Multiplication was, indeed, modular addition and table look ups. Here I used exponential form, because space usage is then uniform. Admittedly binary would do that as well, didn't think about it, really. I have this DLT mostly memorized, and using it is thus simple. Don't necessarily recommend doing it at home this way :-) – Jyrki Lahtonen Jul 29 '24 at 18:50
  • I forgot to mention, for larger fields like $GF(2^{64})$, you can't use log | exp tables, and I'm not aware of a practical way to map to something like $GF((2^{32})^2)$, which might help for finding inverse, but an inverse can be found by using exponentiation by squaring for $a^{2^{64-2}} = 1/a$, and multiply implemented using a carryless multiply instruction. – rcgldr Jul 29 '24 at 23:41
  • @rcgldr I would have paid extra to have PC with a carryless multiply instruction in its assembler instruction set :-) – Jyrki Lahtonen Jul 30 '24 at 04:46