Documentation

# gftable

Generate file to accelerate Galois field computations

## Syntax

```gftable(m,prim_poly);
```

## Description

`gftable(m,prim_poly) ` generates a file that can help accelerate computations in the field GF(`2^m`) as described by the nondefault primitive polynomial `prim_poly`, which can be either a polynomial character vector or an integer. `prim_poly` represents a primitive polynomial for GF(`2^m`), where 1 < m < 16, using the format described in Specifying the Primitive Polynomial. The function places the file, called `userGftable.mat`, in your current working folder. If necessary, the function overwrites any writable existing version of the file.

### Note

If `prim_poly` is the default primitive polynomial for GF(`2^m`) listed in the table on the `gf` reference page, this function has no effect. A MAT-file in your MATLAB installation already includes information that facilitates computations with respect to the default primitive polynomial.

## Examples

In the example below, you expect `t3` to be similar to `t1` and to be significantly smaller than `t2`, assuming that you do not already have a `userGftable.mat` file that includes the (`m`, `prim_poly`) pair (`8`, `501`). Notice that before executing the `gftable` command, MATLAB displays a warning and that after executing `gftable`, there is no warning. By executing the `gftable` command you save the GF table for faster calculations.

```% Sample code to check how much gftable improves speed. tic; a = gf(repmat([0:2^8-1],1000,1),8); b = a.^100; t1 = toc; tic; a = gf(repmat([0:2^8-1],1000,1),8,501); b = a.^100; t2 = toc; gftable(8,501); % Include this primitive polynomial in the file. tic; a = gf(repmat([0:2^8-1],1000,1),8,501); b = a.^100; t3 = toc; ```