Reference index · List of Tcl commands

gf

Name

gf - Create Galois field for the specified characteristic.

Synopsis

gf order

Description

gf creates Galois field for the specified order. The command caches the result, so the consequent calls do not recompute operation tables.

gf always returns a Galois field for a valid order. For nonprime fields, if there is no cached resut previously created by gfpp command, the first primitive polynomial is taken to create a new field. For example, for some q = pt, gf $q can replace the following code:

foreach prime [list_prime_polys -gf [gf $p] $t] {
    if { ![is_primitive_poly $prime] } then { continue }
    return [gfpp $prime]
}

You can always use get_primitive_poly to figure out which polynomial has been used to create the field.

Note: GF(q) is isomorphic to any other GF(q) regardless on the primitive polynomial.

Options

order

Integer. Order of the Galois field, must be a power of prime.

Returns

Galois field (Java reflection object).

Examples

gf 3

Creates GF(3).

gfpp [poly -gf [gf 3] {122} ]
print_poly [get_primitive_poly -gf [gf 9]]

First line creates GF(32 = 9) with the primitive polynomial x2 + 2x + 2 over GF(3). The second line retrieves the previously created GF(9) and prints it's primitive polynomial. Without the first line gf 9 would use default polynomial x2 + x + 2 over GF(3) to create a new field.

print_gf_operations -gf [gf 4]

Creates GF(4) and prints all operation tables. Since there is only one irreducible polynomial of degree 2 over GF(2), gf 4 successfully replaces gfpp [poly -gf [gf 2] {111}].