Hamming Code¶
Given an integer and a field
, such that
,
the
code with length
,
dimension
and minimum distance
is called the Hamming Code of order
.
REFERENCES:
- [Rot2006]
-
class
sage.coding.hamming_code.
HammingCode
(base_field, order)¶ Bases:
sage.coding.linear_code.AbstractLinearCode
Representation of a Hamming code.
INPUT:
base_field
– the base field over whichself
is defined.order
– the order ofself
.
EXAMPLES:
sage: C = codes.HammingCode(GF(7), 3) sage: C [57, 54] Hamming Code over GF(7)
-
minimum_distance
()¶ Returns the minimum distance of
self
. It is always 3 asself
is a Hamming Code.EXAMPLES:
sage: C = codes.HammingCode(GF(7), 3) sage: C.minimum_distance() 3
-
parity_check_matrix
()¶ Returns 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:- the note over section 2.3 in [Rot2006], pages 47-48
- the dedicated paragraph in [HP2003], page 30
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]