6

Is there such a thing as a nonlinear Hamming code?

Please give me a formal definition of Hamming code. Many that I've seen say that a Hamming code is binary, yet I've been given examples of non-binary Hamming codes.

azimut
  • 22,696
ryang
  • 38,879
  • 14
  • 81
  • 179
  • According to Wikipedia, Hamming codes are binary and linear – Hagen von Eitzen May 02 '13 at 21:58
  • 2
    This document contains some information on non-binary Hamming codes. The formal definition is on page 51. I'm not sure about nonlinear Hamming codes. If your (linear) Hamming code is $C$, you could form a nonlinear code $C'$ by taking some $x \not\in C$ and definining $C' = x + C$. However, I would hesitate to call that resulting code $C'$ a Hamming code, since the usual decoding method would no longer work. – Snowball May 02 '13 at 22:29
  • @Snowball,hagen Thanks for the reference. I wonder why so many places define Hamming codes to be binary. – ryang May 02 '13 at 22:36
  • 2
    Hamming codes in the usual sense are linear (check matrix given by listing the points of a projective space, see azimut's +1 answer). If we extend the notion to include all perfect single-error-correcting code (I don't think any author worth mentioning does this), then there are non-linear ones, too. The combinatorial mess of those is daunting, but I know one Bulgarian researcher who is/was serious about classifying them (and made significant progress). I'm sad to say there is a lot of variation in the quality of coding theoretical Wikipedia pages. – Jyrki Lahtonen May 12 '13 at 07:07

1 Answers1

5

Hamming codes exist over any finite base field $\mathbb F_q$, and they are always linear.

Usually they are defined in the following way: A parity check matrix of the Hamming code of codimension $k$ is constructed by writing projective (= up to scalar multiples) representatives of the non-zero vectors in $\mathbb F_q^k$ into the columns of a matrix. If you take this matrix as a generator matrix, the dual of the Hamming code is generated, which is called Simplex code.

For example, for $q = 3$ and $k = 3$, there are $3^3 - 1 = 26$ non-zero vectors in $\mathbb F_3^3$, and a set of projective representatives consists of $26 / 2 = 13$ vectors. A parity check matrix of the Hamming code (and thus, a generator matrix of the Simplex code) is given by $$ \begin{pmatrix} 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 1 & 1 & 2 & 2 & 2 \\ 1 & 0 & 1 & 2 & 0 & 1 & 2 & 0 & 1 & 2 & 0 & 1 & 2 \end{pmatrix}. $$

By the way, this question is somewhat related.

azimut
  • 22,696
  • Any idea how to determine the error correcting capabilities of a non-binary hamming code? – brianmearns Jul 30 '13 at 18:59
  • EDIT: I guess more to the point, do you know how to determine the minimum codeword length required to get a functioning SECSED non-binary Hamming code? – brianmearns Jul 30 '13 at 19:14
  • 1
    @sh1ftst0rm: The minimum distance of any Hamming code (binary or not, and independent of the dimension) is $3$. this mens that you can correct a single error, but not more. – azimut Jul 30 '13 at 21:01
  • It appears that any Hamming code parity check matrix is universal, in that it will work for regardless of whether the data is in binary or some other base. And as azimut said, all Hamming codes have distance 3. The important point for non-binary codes is that when you create the Generator matrix from the parity matrix, the negation that happens has to be in the proper base. – brianmearns Jul 31 '13 at 12:05
  • @sh1ftst0rm: The parity check matrix is not universal. Note the symbols $2$ in the above ternary example. – azimut Jul 31 '13 at 12:29
  • Fair enough in this case, but I believe you can take any parity check matrix from a binary Hamming code, and use it as the parity check for any base. In this case, it will be the generator matrix that has non-binary digits in it. – brianmearns Jul 31 '13 at 12:52
  • Does the ternary matrix you posted really work? You've got a 3x13 check matrix, so wouldn't that give you a (13,10) code? That's way more efficient than the (7,4) code you get with 3 redundant bits in binary Hamming codes. I thought I understood it, now I'm confused. – brianmearns Jul 31 '13 at 12:57
  • Of course it works. The generated code is a ternary linear $[13,10,3]$ code. And of course you could take the check matrix of any binary Hamming code and consider it over a larger base field. But the generated code will be not be a Hamming code over this base field. – azimut Jul 31 '13 at 13:01
  • Rats, looks like I have more learning to do =). When you say it wouldn't be a Hamming code over the larger-base field, do you mean it doesn't function as SEC, or just that it is not strictly a Hamming code (for instance, because it is not a perfect code)? Because I've tested it pretty thorougly and it seems to function well as SEC. But based on your $[13, 10, 3]$ code, it looks like I'm nowhere near optimal data rate. – brianmearns Jul 31 '13 at 13:38
  • @sh1ftst0rm Yes, a possible reason is that you won't get a perfect code then (Hamming codes are perfect). BTW, I don't know what a SEC is. – azimut Jul 31 '13 at 14:30
  • Thanks for all the info, it was sufficient for me to realize that I did not have as good of an understanding of the topic as I thought. "SEC" is "single error correcting", i.e., distance-3. – brianmearns Jul 31 '13 at 14:33