When we send data, we send data + error correction information (EC). Although longer, this transmission will allow detecting and correcting errors in transmission.
k
– len of original message n
– len of transmitted message (data + EC)
The Hamming distance between two n
-bit long messages is the numbers of differences between them.
Example:
d
is the minimal HD between any 2 possible n
-messages.
An (n,k,d)
code is able to detect d-1
errors, and fix $\frac{d-1}{2}$ errors.
Transmitting each bit p
times.
data = 10
p
= 4
data + EC = 11110000
d
= 4
We will now introduce another example for a code.
1
s) in data. (first index is 1)Example:
n
?$|EC| = \lfloor\log_2{2^m-1}\rfloor + 1$
$n = 2^m + m - 1$
d
? How many errors can be detected and fixed?d
= 2Example: 0000000 000 0001000 100
n
,k
,d
now?d
=3, can fix 1 errorRemember to treat the cases of 0 or 1 errors.
decode(transmitted message)
k
bitsk
bitsExample:
In this case we will think there is one error, try to correct, and will insert a third error.
Example:
What is the value of d
now?
Before, we had d
=3. So the closet words were 3 bits apart.
Therefore, they differ in parity, and are now 4 bits apart - d
=4.
We can now detect 3 and fix 1.
# errors | EC vs EC1 vs EC2 | parity |
---|---|---|
0 | V | V |
1 | X or V (if error in parity) | X |
2 | X | V |
3 | X or V (example below) | X |
Examle for not detectin 3 bits by EC:
0010110 000 000 1
We use the above table.
What can we do with the knowledge that we have an error if we cannot fix it?
Pack several messages into a matrix and add EC for matrix columns. Now, even if we have two errors in a row, we might be able to fix each of them, if they are the sole errors in their columns. We might even be able to iterate and fix several errors.
What is a scenario we cannot fix with at most 2 errors in evey row/column?
A rectangle of 4 errors.
This notebook is part of the Extended introduction to computer science course at Tel-Aviv University.
The notebook was written using Python 3.2 and IPython 0.13.1.
The code is available at https://raw.github.com/yoavram/CS1001.py/master/recitation14.ipynb.
The notebook can be viewed online at http://nbviewer.ipython.org/urls/raw.github.com/yoavram/CS1001.py/master/recitation14.ipynb.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.