1. The concept of Hay Ming Code is a code that can correct a wrong error. It uses the information bits to k bits, increasing the R bit, constitutes a n = k r bit codeword, and then uses the R correction factors generated by R-supervised relations to distinguish between unclear and codewords. One of the N different locations in the middle. It must meet the following relationship: 2R> = n 1 or 2R> = k r 1 sea maise code encoding efficiency is: r = k / (k r) in type k is the information bit bit number R to increase the redundancy The number of bits (these are copied from the Internet)
Example 3. Known: The information code is: "1 1 0 0 1 1 0 0" (k = 8) Seeking: Hymming Code. Solution: 1) Insert the redundant code A, B, C, ..., sequentially into the information code, to the Hai Ming Code word: "AB 1 C 1 0 0 D 1 1 0 0" code bits: 1 2 3 4 5 6 7 8 9 10 11 12 Where A, B, C, and D are plugged in 2k bits (k = 0, 1, 2, 3). The code bits are 1, 2, 4, 8, respectively. 2) The linear code bits of redundancys A, B, C, and D are: (equivalent to monitoring relationship) A-> 1, 3, 5, 7, 9, 11; b-> 2, 3, 6, 7 10, 11; C-> 4, 5, 6, 7, 12; (Note 5 = 4 1; 6 = 4 2; 7 = 4 2 1; 12 = 8 4) D-> 8 9, 10, 11, 12. 3) Volume of the value of the linear code bits as the value of redundant code (set by 0): a = σ (0, 1, 1, 0, 1, 0) = 1 b = σ (0, 1, 0, 0, 1, 0) = 0 c = σ (0, 1, 0, 0) = 1 D = σ (0, 1, 1, 0) = 0 4) Sea The yield is: "1 0 1 1 0 0 0 1 1 0 0" Hay Ming Code Reception. Example. Known: The received codeword is: "1 0 0 1 0 0 0 0 1 1 0 0" (k = 8) begins: the information code of the transmitting end. Solution: 1) Set the wrong accumulator (ERR) initial value = 0 2) Ask the redundant doll checks, and is accumulated in Err in the code bit: a = σ (1, 0, 1, 0, 1) , 0) = 1 Err = Err 20 = 1 b = σ (0, 0, 0, 0, 1, 0) = 1 Err = Err 21 = 3 c = σ (1, 1, 0, 0, 0 ) = 0 ERR = Err 0 = 3 d = σ (0, 1, 1, 0) = 0 Err = Err 0 = 3 by Err ≠ 0 to receive code word error, 3) Codeword errors The location is the value of the error accumulator (ERR). 4) Correction - The third bit of the code word is counter-correct code word: "1 0 1 1 0 0 0 1 1 0" 5) Delete the redundancy code at 2k bit: "1 1 0 0 1 1 0 0"
2. Programming to achieve Hayming Code (C )
The following this program is that the stuff in the example is a bit long, but after all, it is the first network experiment of the first network experiment.
# include
The result after COUT << "Remove the error code is:"; for (i = 3; i <13; i ) {if (i == 4 || i == 8) i ; cout << C [i] }}
Run results:
The problem is quite a lot, first, it is not simple enough, but that model 2 is really dizzy, I don't know if C has a simple implementation method.
I don't know which kind of people can help improve it.