December 07, 2022
R Code for GF(4)

The links below give the addition and multiplication tables, and code snippets to implement, for several p,n for Galois fields GF(p^n).

qinfo - data frame to hold all information for specified Galois field
qinfo$inverses - multiplicative inverses (ordered, starting with 1)
qinfo$ainverses - additive inverses (ordered, starting with 0)
qinfo$fqadd - matrix for addition table
qinfo$fqmul - matrix for multiplication table

if (q == 4) {
# generator: x^3 + 2x^2 + 1 (irreducible) ==> x^3 = x^2 + 2
qinfo$inverses = c(1,3,2)
qinfo$ainverses= c(0,1,2,3)
qinfo$fqadd=
matrix(c(
00,01,02,03,
01,00,03,02,
02,03,00,01,
03,02,01,00
),q)
qinfo$fqmul=
matrix(c(
00,00,00,00,
00,01,02,03,
00,02,03,01,
00,03,01,02
),q)
} # if (q==4)