R Code for GF(9)
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 == 9) {
qinfo$inverses=c(1,2,5,8,3,7,6,4)
qinfo$ainverses=c(0,2,1,6,8,7,3,5,4)
qinfo$fqadd=
matrix(c(
0,1,2,3,4,5,6,7,8,
1,2,0,4,5,3,7,8,6,
2,0,1,5,3,4,8,6,7,
3,4,5,6,7,8,0,1,2,
4,5,3,7,8,6,1,2,0,
5,3,4,8,6,7,2,0,1,
6,7,8,0,1,2,3,4,5,
7,8,6,1,2,0,4,5,3,
8,6,7,2,0,1,5,3,4
),q)
qinfo$fqmul=
matrix(c(0,0,0,0,0,0,0,0,0,
0,1,2,3,4,5,6,7,8,
0,2,1,6,8,7,3,5,4,
0,3,6,4,7,1,8,2,5,
0,4,8,7,2,3,5,6,1,
0,5,7,1,3,8,2,4,6,
0,6,3,8,5,2,4,1,7,
0,7,5,2,6,4,1,8,3,
0,8,4,5,1,6,7,3,2
),q)
} # if (q==9)
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 == 9) {
qinfo$inverses=c(1,2,5,8,3,7,6,4)
qinfo$ainverses=c(0,2,1,6,8,7,3,5,4)
qinfo$fqadd=
matrix(c(
0,1,2,3,4,5,6,7,8,
1,2,0,4,5,3,7,8,6,
2,0,1,5,3,4,8,6,7,
3,4,5,6,7,8,0,1,2,
4,5,3,7,8,6,1,2,0,
5,3,4,8,6,7,2,0,1,
6,7,8,0,1,2,3,4,5,
7,8,6,1,2,0,4,5,3,
8,6,7,2,0,1,5,3,4
),q)
qinfo$fqmul=
matrix(c(0,0,0,0,0,0,0,0,0,
0,1,2,3,4,5,6,7,8,
0,2,1,6,8,7,3,5,4,
0,3,6,4,7,1,8,2,5,
0,4,8,7,2,3,5,6,1,
0,5,7,1,3,8,2,4,6,
0,6,3,8,5,2,4,1,7,
0,7,5,2,6,4,1,8,3,
0,8,4,5,1,6,7,3,2
),q)
} # if (q==9)