Go to the first, previous, next, last section, table of contents.

### `setmod_ff`

`setmod_ff([prime|poly])`
`setmod_ff(prime,n])`
  :: Sets/Gets the current base fields.

return
  number or polynomial
prime
  prime
poly
  univariate polynomial irreducible over GF(2)
n
  the extension degree

- If the argument is a non-negative integer prime, GF(prime) is set as the current base field.
- If the argument is a polynomial poly, GF(2^deg(poly mod 2)) = GF(2)[t]/(poly(t) mod2) is set as the current base field.
- If the arguments are a prime p and an extension degree n, GF(p^n) is set as the current base field. p^n must be less than 2^29 and if p is greater than or equal to 2^14, then n must be equal to 1.
- If no argument is specified, the modulus indicating the current base field is returned. If the current base field is GF(prime), prime is returned. If it is GF(2^n), the defining polynomial is returned. If it is GF(p^n), where p^n is less than 2^14, [p,defpoly,prim_elem] is returned. Here, defpoly is the defining polynomial of the n-th extension, and prim_elem is the generator of the multiplicative group of GF(p^n).
- Any irreducible univariate polynomial over GF(2) is available to set GF(2^n). However the use of `defpoly_mod2()` is recommended for efficiency.

    [174] defpoly_mod2(100);
    x^100+x^15+1
    [175] setmod_ff(@@);
    x^100+x^15+1
    [176] setmod_ff();
    x^100+x^15+1
    [177] setmod_ff(2,5);
    [2,x^5+x^2+1,x]

`References`
  section `defpoly_mod2`

Go to the first, previous, next, last section, table of contents.