Hamming codes¶
Given an integer \(r\) and a field \(F\), such that \(F=\GF{q}\), the \([n, k, d]\) code with length \(n=\frac{q^{r}-1}{q-1}\), dimension \(k=\frac{q^{r}-1}{q-1} - r\) and minimum distance \(d=3\) is called the Hamming Code of order \(r\).
REFERENCES:
- class sage.coding.hamming_code.HammingCode(base_field, order)[source]¶
Bases:
AbstractLinearCode
Representation of a Hamming code.
INPUT:
base_field
– the base field over whichself
is definedorder
– the order ofself
EXAMPLES:
sage: C = codes.HammingCode(GF(7), 3) sage: C [57, 54] Hamming Code over GF(7)
>>> from sage.all import * >>> C = codes.HammingCode(GF(Integer(7)), Integer(3)) >>> C [57, 54] Hamming Code over GF(7)
- minimum_distance()[source]¶
Return the minimum distance of
self
.It is always 3 as
self
is a Hamming Code.EXAMPLES:
sage: C = codes.HammingCode(GF(7), 3) sage: C.minimum_distance() 3
>>> from sage.all import * >>> C = codes.HammingCode(GF(Integer(7)), Integer(3)) >>> C.minimum_distance() 3
- parity_check_matrix()[source]¶
Return a parity check matrix of
self
.The construction of the parity check matrix in case
self
is not a binary code is not really well documented. Regarding the choice of projective geometry, one might check:EXAMPLES:
sage: C = codes.HammingCode(GF(3), 3) sage: C.parity_check_matrix() [1 0 1 1 0 1 0 1 1 1 0 1 1] [0 1 1 2 0 0 1 1 2 0 1 1 2] [0 0 0 0 1 1 1 1 1 2 2 2 2]
>>> from sage.all import * >>> C = codes.HammingCode(GF(Integer(3)), Integer(3)) >>> C.parity_check_matrix() [1 0 1 1 0 1 0 1 1 1 0 1 1] [0 1 1 2 0 0 1 1 2 0 1 1 2] [0 0 0 0 1 1 1 1 1 2 2 2 2]