# 7,4 Hamming Codes

By my count, there are $7!$ ways to choose an ordering of message bits and parity bits, but each choice generates a $G$ with $4$ columns that can be reordered to yield $4!$ possible orderings that generate the same exact code. So, my guess is that there are $\frac7!4! = 7 \times 6 \times 5 = 210$ unique codes. I haven't encountered this number online so I feel like my count is wrong. It also seems unrealistically large, and a stupid guess is that the answer is actually $7\choose4=35$ unique codes - this feels right but I have no idea why I would divide by $3!$.

## 7,4 Hamming Codes

One can count dual Hamming codes which are in bijection with Hamming codes. They are precisely the codes with generator matrix which consists of all $7$ non-zero binary columns of size $3$ (in some order).

There are $7!$ such matrices, but different matrices can generate the same code. Two matrices $H$ and $H'$ (with $3$ rows and $7$ columns) generate the same code if and only if $H'=TH$ where $T$ is an invertible $3\times 3$ matrix. Since there are $168$ invertible $3\times 3$ binary matrices, each dual Hamming code has $168$ generator matrices. Hence there are $\frac7!168=30$ distinct dual Hamming codes.

When data is transmitted over a channel, errors are often introduced due to noise, and what not. To account for the losses, redundant data is added the actual data and transmitted. This data can be used to detect, and correct errors up to an extent. This is known as Channel Coding, and Hamming codes are an example.

In previous posts, we have discussed convolutional codes with Viterbi decoding (hard decision, soft decision and with finite traceback). Let us know discuss a block coding scheme where a group of information bits is mapped into coded bits. Such codes are referred to as codes. We will restrict the discussion to Hamming codes, where 4 information bits are mapped into 7 coded bits. The performance with and without coding is compared using BPSK modulation in AWGN only scenario.

@victor: Well, that should be simple.You can group two coded bits into a QPSK, add awgn noise, demap into bits, then hamming decodeYou can use this code as reference for qpsk mapping and demapping -error-rate-for-4-qam/

I am wondering how can i use your code using MATLAB function for Hamming to find BER and final graph? [ encoded_msg=encode(tmsg,7,4,'hamming/binary') decodeed_msg=decode(rmsg,7,4,'hamming/binary') ]

In the late 1940s Richard Hamming recognized that the further evolution of computers required greater reliability, in particular the ability to detect and correct errors. (At the time, parity checking was being used to detect errors, but was unable to correct any errors.) He created the, Hamming Codes, perfect 1-error correcting codes, and the extended Hamming Codes, 1-error correcting and 2-error detecting codes. Hamming Codes are still widely used in computing, telecommunication, and other applications including data compression, popular puzzles, and turbo codes. At the time, Hamming worked at Bell Telephone Laboratories and was frustrated with the error-prone punched card reader, which is why he started working on error-correcting codes.

The goal of the Hamming codes is to create a set of parity bits that overlap such that a single-bit error (the bit is logically flipped in value) in a data bit or a parity bit can be detected and corrected.

Hamming codes can be computed in linear algebra terms through matrices because Hamming codes are linear codes. For the purposes of Hamming codes, two Hamming matrices can be defined: the code generator matrix G and the parity-check matrix H:

The diversity and scope of multiplex parallel sequencing applications is steadily increasing. Critically, multiplex parallel sequencing applications methods rely on the use of barcoded primers for sample identification, and the quality of the barcodes directly impacts the quality of the resulting sequence data. Inspection of the recent publications reveals a surprisingly variable quality of the barcodes employed. Some barcodes are made in a semi empirical fashion, without quantitative consideration of error correction or minimal distance properties. After systematic comparison of published barcode sets, including commercially distributed barcoded primers from Illumina and Epicentre, methods for improved, Hamming code-based sequences are suggested and illustrated. Hamming barcodes can be employed for DNA tag designs in many different ways while preserving minimal distance and error-correcting properties. In addition, Hamming barcodes remain flexible with regard to essential biological parameters such as sequence redundancy and GC content. Wider adoption of improved Hamming barcodes is encouraged in multiplex parallel sequencing applications.

The whole elegance of Hamming coding system resides in detecting and correcting errors. The positioning of parity bits is made in such way that when corresponding checksums are put together in one row, they indicate the position of the error in binary format. In principle, Hamming codes can be redefined in a quaternary alphabet thus excluding code conversion. In programming languages, parity check is performed by using modulo function. This function finds the remainder of division of one number by another. For binary code mod 2 is used, correspondingly mod 4 is used for quaternary code. Bases A,C,G,T will be encoded as 0,1,2,3 correspondingly. The original Hamming error correction principle can be easily adjusted to quaternary code (or any other metrics). The outline is given in Fig. 1. For example, in a Hamming(7,4) code when an error occurs, 1 of the 3 checksums will become non-zero, when put together in a row, Ch3,Ch2,Ch1 will show the position of the error in binary format. For instance binary 010 will report error in the position 2, binary 011 will report error in the position 3 (000 stands for no errors). In binary code the error type is not specified since it is either of two states. In quaternary format when calculating checksum over the bases values, the occurring error will generate checksum values from 1 to 3. This value will be used to identify the correct base relatively to the base produced by error. In addition to this an extra step will be taken, namely converting all non-zero checksums to 1, which will restore the original Hamming error position detection algorithm. An advantage of such an approach is that instead of converting whole codes we only convert the decoding algorithm. Details of such a quaternary Hamming code correction are given in a Supplementary File S2. Note that this decoding algorithm is not limited to the quaternary codes only.

My issue is that my finite state machine is not working how it should be as asked from the lab assignment. The state machine is supposed to have 3 states; idle, s1, s2. Idle is supposed to show all zeros in the waveform, State 1 will show the randomly generated 4-bit number from the LFSR, and State 2 will show the result from the 4-bit number after hamming (7,4) is done. The clock is changed to a 1HZ clock, clk division used.

The previous post looked at how to choose five or six letters so that their Morse code representations are as distinct as possible. This post will build on the previous one to introduce Hamming codes. The problem of finding Hamming codes is much simpler in some ways, but also more general.

The set of words we will use for transmitting messages is called a code. In the previous post, the code consisted originally of A, D, F, G, and V, and we looked at codes that would have been better by several criteria.

If you don't know when a disk has failed, you can use Hamming codes to detect and repair failures. A (7,4) hamming code stores 4 bits of data using 7 bits, and can detect up to two failures (two of the seven bits being flipped) and can repair one failure (if only one bit is flipped, the flipped bit can be identified and thus un-flipped)

Parity can be used instead of hamming codes to handle single known errors (by known errors, we mean that the controller is notified when a disk fails). The parity p of bits b0 b1 b2 ... bn is simply the exclusive or of all of the bits. In general,

Reed-Solomon codes generalize parity to allow two or more parity bits to be computed. With two bits of parity, one can correct two known failures. This allows two simultaneous failures to be handled.

Whenever data is transmitted or stored, it's possible that the data may become corrupted. This can take the form of bit flips, where a binary 1 becomes a 0 or vice versa. Error correcting codes seek to find when an error is introduced into some data. This is done by adding parity bits, or redundant information, to the data.

Hamming code is not used in modern data transmission. Wired data connections are generally not noisy enough to warrant the overhead of added parity data, and if an error is encountered, it may be faster to ask the sender to retransmit the faulty packet. Also, low-density parity-check (LDPC) codes are more efficient to transmit but require more computation than Hamming code. Since modern computers have more processing power available, LDPC is used for Wi-Fi 6 and 10GBASE-T Ethernet.

In this coding method, the source encodes the message by inserting redundant bits within the message. These redundant bits are extra bits that are generated and inserted at specific positions in the message itself to enable error detection and correction. When the destination receives this message, it performs recalculations to detect errors and find the bit position that has error.

The automorphism group of a code is useful in the study of equivalence classes of codes. In this paper, I use some methods to construct automorphism groups of Hamming codes [[bar.A].sub.7] and [A.sub.8] respectively. Hamming codes [[bar.A].sub.7] and [A.sub.8] are self-orthogonal codes, and [A.sub.8] is also self-dual. I prove that the automorphism group of [[bar.A].sub.7] and linear transformation group [GL.sub.3](2) to be isomorphism, and then I extend code [[bar.A].sub.7] to [8, 4] code. Finally I construct the automorphism group [Z.sup.3.sub.2]Aut([[bar.A].sub.7]) of Hamming code [A.sub.8] on the basis of group Aut([[bar.A].sub.7]).