Parity-check and generator matrices for Hamming code

returns an
`h`

= hammgen(`m`

)`m`

-by-*n* parity-check matrix,
`h`

, for a Hamming code of codeword length

. The message length of the Hamming code is
*n*
= 2^{m}–1*n* – `m`

. The binary primitive polynomial that the
function uses to create the Hamming code is the default primitive polynomial in
GF(`2^`

). For more details of this default
polynomial, see the `m`

`gfprimdf`

function.

`hammgen`

uses the function `gftuple`

to create the parity-check matrix by converting each element in the
Galois field (GF) to its polynomial representation. Unlike `gftuple`

, which
performs computations in GF(`2`

) and processes
one ^{m}`m`

-tuple at a time, the `hammgen`

function
generates the entire sequence from 0 to `2`

.
The computation algorithm uses all previously computed values to generate the computation
result. If the value of ^{m}–1`m`

is less than 25 and the primitive polynomial is
the default primitive polynomial for GF(`2`

), the
syntax ^{m}`hammgen(`

might be faster than the syntax
`m`

)`hammgen(`

.`m`

,`poly`

)