Main Content

gftuple

Simplify or convert Galois field element formatting

Description

gftuple serves to simplify the polynomial or exponential format of Galois field elements, or to convert from one format to another. For an explanation of the formats that gftuple uses, see Representing Elements of Galois Fields.

The format of an element of GF(pm) is called simplest if all exponents of the primitive element are

  • In the range [0, (m – 1)] for the polynomial format

  • Either -Inf, or in the range [0, (pm – 2)], for the exponential format

The exponential or polynomial formats mentioned above are all relative to a primitive element specified by the second input argument. The second argument is described below.

gftuple uses recursive callbacks to determine the exponential format.

tp = gftuple(a,m) returns the simplest polynomial format of the elements that a represents, where the kth row of tp corresponds to the kth row of a. The formats are relative to a root of the default primitive polynomial for GF(2m), where m is a positive integer.

Note

This function performs computations in GF(pm), where p is prime. To perform equivalent computations in GF(2m), apply the .^ operator and the log function to Galois arrays. For more information, see Example: Exponentiation and Example: Elementwise Logarithm.

example

tp = gftuple(a,prim_poly) is the same as the syntax above, except that prim_poly is a polynomial character vector or a row vector that lists the coefficients of a degree m primitive polynomial for GF(2m) in order of ascending exponents.

tp = gftuple(a,m,p) is the same as tp = gftuple(a,m) except that 2 is replaced by a prime number p.

tp = gftuple(a,prim_poly,p) is the same as tp = gftuple(a,prim_poly) except that 2 is replaced by a prime number p.

tp = gftuple(a,prim_poly,p,prim_ck) is the same as tp = gftuple(a,prim_poly,p) except that gftuple checks whether prim_poly represents a polynomial that is indeed primitive. If not, then gftuple generates an error and tp is not returned. The input argument prim_ck can be any number or character vector; only its existence matters.

[tp,expform] = gftuple(...) returns the additional matrix expform. The kth row of expform is the simplest exponential format of the element that the kth row of a represents. All other features are as described in previous syntaxes, depending on the input arguments.

Examples

collapse all

This example shows how to create a list of all elements in GF(pm), arranged relative to a root of the default primitive polynomial.

p = 5; % Any prime number
m = 4; % Any positive integer
field = gftuple((-1:p^m-2)', m, p)
field = 625×4

     0     0     0     0
     1     0     0     0
     0     1     0     0
     0     0     1     0
     0     0     0     1
     3     3     4     0
     0     3     3     4
     2     2     4     3
     4     1     4     4
     2     1     2     4
     2     4     2     2
     1     3     2     2
     1     2     1     2
     1     2     0     1
     3     4     1     0
      ⋮

Input Arguments

collapse all

Galois field elements, specified as a numeric matrix. Each row in the matrix represents an element in the Galois field.

For all syntaxes:

  • If a is a column vector of integers: each row is interpreted as the exponential format of a Galois field element.

  • If a has more than one column: each row is interpreted as the polynomial format, with each entry an integer in the range [0, (p–1)].

Data Types: single | double

Order of primitive polynomial, specified as a positive integer from 1 through 16. The function uses this value to calculate the distinct number of elements in the GF.

Data Types: double

Prime number, specified as a scalar prime number.

Data Types: double

Primitive polynomial, specified as one of these options:

  • Binary row vector — This vector specifies coefficients of prim_poly in the order of ascending powers.

  • Character vector or a string scalar — This value defines prim_poly in a textual representation. For more details, refer to polynomial character vector.

  • Positive integer — This value defines prim_poly in the range [(2m + 1), (2m+1 – 1)].

Data Types: double | char | string

Primitive polynomial check, specified as a any number or a character vector. The existence of this input trigger the primitive polynomial check.

Data Types: double

Output Arguments

collapse all

Simplified polynomial format of Galois field elements, returned as a numeric matrix. Each row in the matrix is the simplest polynomial format for the corresponding element in a.

Data Types: single | double

Simplified exponential format, returned as numeric column vector. Each row in the vector is the simplest exponential format for the corresponding element a.

Data Types: double

Version History

Introduced before R2006a