0% found this document useful (0 votes)
169 views30 pages

Galois Fields for MATLAB Users

This document discusses computations involving Galois fields, which are finite algebraic fields used in error-control coding. It describes how to represent elements of Galois fields GF(2m) as arrays in MATLAB and perform computations on them using similar syntax as real number arrays. Key topics covered include Galois field terminology, representing elements, primitive polynomials, arithmetic, logical and linear algebra operations, and functions for specific computations in Galois fields.

Uploaded by

litter_trash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views30 pages

Galois Fields for MATLAB Users

This document discusses computations involving Galois fields, which are finite algebraic fields used in error-control coding. It describes how to represent elements of Galois fields GF(2m) as arrays in MATLAB and perform computations on them using similar syntax as real number arrays. Key topics covered include Galois field terminology, representing elements, primitive polynomials, arithmetic, logical and linear algebra operations, and functions for specific computations in Galois fields.

Uploaded by

litter_trash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Galois Field Computations

A Galois field is an algebraic field that has a finite number of members. This section describes
how to work with fields that have 2m members, where m is an integer between 1 and 16. Such
fields are denoted GF(2m). Galois fields having 2m members are used in error-control coding. If
you need to use Galois fields having an odd number of elements, see Appendix: Galois Fields
of Odd Characteristic in the online documentation for the Communications Toolbox.

Galois Field Features of the Toolbox

The Communications Toolbox facilitates computations in Galois fields that have 2 m members.
You can create array variables whose values are in GF(2m) and use these variables to perform
computations in the Galois field. Most computations use the same syntax that you would use
to manipulate ordinary MATLAB arrays of real numbers, making the GF(2 m) capabilities of the
toolbox easy to learn and use.

The topics in this section are

Galois Field Terminology


Representing Elements of Galois Fields
Primitive Polynomials and Element Representations
Arithmetic in Galois Fields
Logical Operations in Galois Fields
Matrix Manipulation in Galois Fields
Linear Algebra in Galois Fields
Signal Processing Operations in Galois Fields
Polynomials over Galois Fields
Manipulating Galois Variables
Speed and Nondefault Primitive Polynomials

For background information about Galois fields or their use in error-control coding, see the
works listed in Selected Bibliography for Galois Fields.

For more details about specific functions that process arrays of Galois field elements, see the
online reference entries in the documentation for MATLAB or for the Communications Toolbox.
Functions whose behavior is identical to the corresponding MATLAB function, except for the
ability to handle Galois field members, do not have reference entries in this manual because
the entries would be identical to those in the MATLAB manual.

Galois Field Terminology

The discussion of Galois fields in this document uses a few terms that are not used
consistently in the literature. The definitions adopted here appear in van Lint [4].
A primitive element of GF(2m) is a cyclic generator of the group of nonzero elements of
GF(2m). This means that every nonzero element of the field can be expressed as the
primitive element raised to some integer power.
A primitive polynomial for GF(2m) is the minimal polynomial of some primitive element
of GF(2m). That is, it is the binary-coefficient polynomial of smallest nonzero degree
having a certain primitive element as a root in GF(2m). As a consequence, a primitive
polynomial has degree m and is irreducible.

The definitions imply that a primitive element is a root of a corresponding primitive polynomial.

This section describes how to create a Galois array, which is a MATLAB expression that
represents elements of a Galois field. This section also describes how MATLAB interprets the
numbers that you use in the representation, and includes several examples. The topics are

Creating a Galois Array


Example: Creating Galois Field Variables
Example: Representing Elements of GF(8)
How Integers Correspond to Galois Field Elements
Example: Representing a Primitive Element

Creating a Galois Array

To begin working with data from a Galois field GF( ), you must set the context by
associating the data with crucial information about the field. The function performs this
association and creates a Galois array in MATLAB. This function accepts as inputs

The Galois field data, , which is a MATLAB array whose elements are integers
between 0 and .
(Optional) An integer, , that indicates that is in the field GF( ). Valid values of
are between 1 and 16. The default is 1, which means that the field is GF(2).
(Optional) A positive integer that indicates which primitive polynomial for GF( ) you
are using in the representations in . If you omit this input argument, then uses a
default primitive polynomial for GF( ). For information about this argument, see
Specifying the Primitive Polynomial.

The output of the function is a variable that MATLAB recognizes as a Galois field array,
rather than an array of integers. As a result, when you manipulate the variable, MATLAB works
within the Galois field you have specified. For example, if you apply the function to a
Galois array, then MATLAB computes the logarithm in the Galois field and not in the field of
real or complex numbers.

When MATLAB Implicitly Creates a Galois Array. Some operations on Galois arrays
require multiple arguments. If you specify one argument that is a Galois array and another that
is an ordinary MATLAB array, then MATLAB interprets both as Galois arrays in the same field.
That is, it implicitly invokes the function on the ordinary MATLAB array. This implicit
invocation simplifies your syntax because you can omit some references to the function.
For an example of the simplification, see Example: Addition and Subtraction.

Example: Creating Galois Field Variables

The code below creates a row vector whose entries are in the field GF(4), and then adds the
row to itself.

The output is

The output shows the values of the Galois arrays named and . Notice that each output
section indicates

The field containing the variable, namely, GF(2^2) = GF(4).


The primitive polynomial for the field. In this case, it is the toolbox's default primitive
polynomial for GF(4).
The array of Galois field values that the variable contains. In particular, the array
elements in are exactly the elements of the vector , while the array elements in
are four instances of the zero element in GF(4).

The command that creates shows how, having defined the variable as a Galois array, you
can add to itself by using the ordinary operator. MATLAB performs the vectorized addition
operation in the field GF(4). Notice from the output that
Compared to , is in the same field and uses the same primitive polynomial. It is not
necessary to indicate the field when defining the sum, , because MATLAB
remembers that information from the definition of the addends, .
The array elements of are zeros because the sum of any value with itself, in a Galois
field of characteristic two, is zero. This result differs from the sum , which
represents an addition operation in the infinite field of integers.

Example: Representing Elements of GF(8)

To illustrate what the array elements in a Galois array mean, the table below lists the elements
of the field GF(8) as integers and as polynomials in a primitive element, A. The table should
help you interpret a Galois array like

Integer Representation Binary Representation Element of GF(8)

0 000 0

1 001 1

2 010 A

3 011 A+1

4 100 A2

5 101 A2 + 1

6 110 A2 + A

7 111 A2 + A + 1

How Integers Correspond to Galois Field Elements

Building on the GF(8) example above, this section explains the interpretation of array elements
in a Galois array in greater generality. The field GF( ) has distinct elements, which
this toolbox labels as 0, 1, 2,..., . These integer labels correspond to elements of the
Galois field via a polynomial expression involving a primitive element of the field. More
specifically, each integer between 0 and has a binary representation in bits. Using
the bits in the binary representation as coefficients in a polynomial, where the least significant
bit is the constant term, leads to a binary polynomial whose order is at most . Evaluating
the binary polynomial at a primitive element of GF( ) leads to an element of the field.
Conversely, any element of GF( ) can be expressed as a binary polynomial of order at
most , evaluated at a primitive element of the field. The -tuple of coefficients of the
polynomial corresponds to the binary representation of an integer between 0 and .

Below is a symbolic illustration of the correspondence of an integer X, representable in binary


form, with a Galois field element. Each bk is either zero or one, while A is a primitive element.

Example: Representing a Primitive Element

The code below defines a variable that represents a primitive element of the field
GF(24).

The output is

The Galois array represents a primitive element because of the correspondence


between

The integer 2, specified in the syntax


The binary representation of 2, which is 10 (or 0010 using four bits)
The polynomial A + 0, where A is a primitive element in this field (or 0A 3 + 0A2 + A + 0
using the four lowest powers of A)

Primitive Polynomials and Element Representations

This section builds on the discussion in Representing Elements of Galois Fields by describing
how to specify your own primitive polynomial when you create a Galois array. The topics are

Specifying the Primitive Polynomial


Finding Primitive Polynomials
Effect of Nondefault Primitive Polynomials on Numerical Results
If you perform many computations using a nondefault primitive polynomial, then see Speed
and Nondefault Primitive Polynomials as well.

Specifying the Primitive Polynomial

The discussion in How Integers Correspond to Galois Field Elements refers to a primitive
element, which is a root of a primitive polynomial of the field. When you use the function to
create a Galois array, the function interprets the integers in the array with respect to a specific
default primitive polynomial for that field, unless you explicitly provide a different primitive
polynomial. A list of the default primitive polynomials is on the reference page for the
function.

To specify your own primitive polynomial when creating a Galois array, use a syntax like

instead of

The extra input argument, in this case, specifies the primitive polynomial for the field
GF( ) in a way similar to the representation described in How Integers Correspond to Galois
Field Elements. In this case, the integer 25 corresponds to a binary representation of 11001,
which in turn corresponds to the polynomial D4 + D3 + 1.

Note When you specify the primitive polynomial, the input argument must have a
binary representation using exactly bits, not including unnecessary leading
zeros. In other words, a primitive polynomial for GF( ) always has order .

When you use an input argument to specify the primitive polynomial, the output reflects your
choice by showing the integer value as well as the polynomial representation.
Note After you have defined a Galois array, you cannot change the primitive
polynomial with respect to which MATLAB interprets the array elements.

Finding Primitive Polynomials

You can use the function to find primitive polynomials for GF( ) and the
function to determine whether a polynomial is primitive for GF( ). The
code below illustrates.
Effect of Nondefault Primitive Polynomials on Numerical Results

Most fields offer multiple choices for the primitive polynomial that helps define the
representation of members of the field. When you use the function, changing the primitive
polynomial changes the interpretation of the array elements and, in turn, changes the results of
some subsequent operations on the Galois array. For example, exponentiation of a primitive
element makes it easy to see how the primitive polynomial affects the representations of field
elements.

The output below shows that when the primitive polynomial has integer representation , the
Galois array satisfies a certain equation. By contrast, when the primitive polynomial has
integer representation , the Galois array fails to satisfy the equation.
The output when you try this example might also include a warning about lookup tables. This is
normal if you did not use the function to optimize computations involving a
nondefault primitive polynomial of 13.

Arithmetic in Galois Fields

You can perform arithmetic operations on Galois arrays by using the same MATLAB operators
that work on ordinary integer arrays. The table below lists the available arithmetic operations
as well as the operators that perform them. Whenever you operate on a pair of Galois arrays,
both arrays must be in the same Galois field.

Operation Operator

Addition

Subtraction

Elementwise multiplication

Matrix multiplication

Elementwise left division

Elementwise right division

Matrix left division

Matrix right division

Elementwise exponentiation

Elementwise logarithm

Exponentiation of a square Galois matrix by a scalar integer

Note For multiplication and division of polynomials over a Galois field, see Addition
and Subtraction of Polynomials.

Examples of these operations are in the sections that follow:

Example: Addition and Subtraction


Example: Multiplication
Example: Division
Example: Exponentiation
Example: Elementwise Logarithm

Example: Addition and Subtraction


The code below adds two Galois arrays to create an addition table for GF(8). Addition uses the
ordinary operator. The code below also shows how to index into the array to find
the result of adding 1 to the elements of GF(8).

As an example of reading this addition table, the (7,4) entry in the array shows that
plus equals . Equivalently, the element A2+A plus the
element A+1 equals the element A2+1. The equivalence arises from the binary representation
of 6 as 110, 3 as 011, and 5 as 101.

The subtraction table, which you can obtain by replacing by , would be the same as
. This is because subtraction and addition are identical operations in a field of
characteristic two. In fact, the zeros along the main diagonal of illustrate this fact for
GF(8).

Simplifying the Syntax. The code below illustrates scalar expansion and the implicit
creation of a Galois array from an ordinary MATLAB array. The Galois arrays and are
identical, but the creation of uses a simpler syntax.
Notice that 1+5 is reported as 4 in the Galois field. This is true because the 5 represents the
polynomial expression A2+1, and 1+(A2+1) in GF(16) is A2. Furthermore, the integer that
represents the polynomial expression A2 is 4.

Example: Multiplication

The example below multiplies individual elements in a Galois array using the operator. It
then performs matrix multiplication using the operator. The elementwise multiplication
produces an array whose size matches that of the inputs. By contrast, the matrix multiplication
produces a Galois scalar because it is the matrix product of a row vector with a column vector.

Multiplication Table for GF(8). As another example, the code below multiplies two Galois
vectors using matrix multiplication. The result is a multiplication table for GF(8).
Example: Division

The examples below illustrate the four division operators in a Galois field by computing
multiplicative inverses of individual elements and of an array. You can also compute inverses
using or using exponentiation by -1.

Elementwise Division. This example divides 1 by each of the individual elements in a


Galois array using the and operators. These two operators differ only in their sequence
of input arguments. Each quotient vector lists the multiplicative inverses of the nonzero
elements of the field. In this example, MATLAB expands the scalar 1 to the size of before
computing; alternatively, you can use as arguments two arrays of the same size.

Matrix Division. This example divides the identity array by the square Galois array
using the and operators. Each quotient matrix is the multiplicative inverse of . Notice
how the transpose operator ( ) appears in the equivalent operation using . For square
matrices, the sequence of transpose operations is unnecessary, but for nonsquare matrices, it
is necessary.

Example: Exponentiation

The examples below illustrate how to compute integer powers of a Galois array. To perform
matrix exponentiation on a Galois array, you must use a square Galois array as the base and
an ordinary (not Galois) integer scalar as the exponent.

Elementwise Exponentiation. This example computes powers of a primitive element, A, of


a Galois field. It then uses these separately computed powers to evaluate the default primitive
polynomial at A. The answer of zero shows that A is a root of the primitive polynomial. Notice
that the operator exponentiates each array element independently.

Matrix Exponentiation. This example computes the inverse of a square matrix by raising
the matrix to the power -1. It also raises the square matrix to the powers 2 and -2.

Example: Elementwise Logarithm

The code below computes the logarithm of the elements of a Galois array. The output
indicates how to express each nonzero element of GF(8) as a power of the primitive element.
The logarithm of the zero element of the field is undefined.

As an example of how to interpret the output, consider the last entry in each vector in this
example. You can infer that the element in GF(8) can be expressed as either
A5, using the last element of
A2+A+1, using the binary representation of 7 as 111. See Example: Representing
Elements of GF(8) for more details.

Logical Operations in Galois Fields

You can apply logical tests to Galois arrays and obtain a logical array. Some important types of
tests are testing for equality of two Galois arrays and testing for nonzero values in a Galois
array.

Testing for Equality

To compare corresponding elements of two Galois arrays that have the same size, use the
operators and . The result is a logical array, each element of which indicates the truth or
falsity of the corresponding elementwise comparison. If you use the same operators to
compare a scalar with a Galois array, then MATLAB compares the scalar with each element of
the array, producing a logical array of the same size.

The output is below.


Comparison of isequal and ==. To compare entire arrays and obtain a logical scalar result
rather than a logical array, you can use the built-in function. Note, however, that
uses strict rules for its comparison, and returns a value of (false) if you compare

A Galois array with an ordinary MATLAB array, even if the values of the underlying
array elements match
A scalar with a nonscalar array, even if all elements in the array match the scalar

The example below illustrates this difference between and .

Testing for Nonzero Values

To test for nonzero values in a Galois vector, or in the columns of a Galois array that has more
than one row, use the or function. These two functions behave just like the ordinary
MATLAB functions and , except that they consider only the underlying array
elements while ignoring information about which Galois field the elements are in. Examples
are below.
Matrix Manipulation in Galois Fields

Some basic operations that you would perform on an ordinary MATLAB array are available for
Galois arrays. This section illustrates how to perform basic manipulations and how to get basic
information.

Basic Manipulations of Galois Arrays

Basic array operations that you can perform on a Galois array include those in the table below.
The results of these operations are Galois arrays in the same field. The functionality of these
operations is analogous to the MATLAB operations having the same syntax.

Operation Syntax

Index into array, possibly using or , where


colon operator instead of a vector of and/or can be " " instead of a
explicit indices vector

Transpose array

Concatenate matrices or

Create array having specified or


diagonal elements

Extract diagonal elements or

Extract lower triangular part or

Extract upper triangular part or

Change shape of array

The code below uses some of these syntaxes.


Basic Information About Galois Arrays

You can determine the length of a Galois vector or the size of any Galois array using the
and size functions. The functionality for Galois arrays is analogous to that of the
MATLAB operations on ordinary arrays, except that the output arguments from and
are always integers, not Galois arrays. The code below illustrates the use of these
functions.

Positions of Nonzero Elements. Another type of information you might want to determine
from a Galois array is the positions of nonzero elements. For an ordinary MATLAB array, you
might use the function. However, for a Galois array you should use in
conjunction with the operator, as illustrated.

Linear Algebra in Galois Fields

You can do linear algebra in a Galois field using Galois arrays. Important categories of
computations are inverting matrices, computing determinants, computing ranks, factoring
square matrices, and solving linear equations.

Inverting Matrices and Computing Determinants

To invert a square Galois array, use the function. Related is the function, which
computes the determinant of a Galois array. Both and behave like their ordinary
MATLAB counterparts, except that they perform computations in the Galois field instead of in
the field of complex numbers.

Note A Galois array is singular if and only if its determinant is exactly zero. It is not
necessary to consider roundoff errors, as in the case of real and complex arrays.

The code below illustrates matrix inversion and determinant computation.

The output from this example is either of these two messages, depending on whether the
randomly generated matrix is nonsingular or singular.

Computing Ranks

To compute the rank of a Galois array, use the function. It behaves like the ordinary
MATLAB function when given exactly one input argument. The example below
illustrates how to find the rank of square and nonsquare Galois arrays.
The values of and indicate that has less than full rank but that
has full rank.

Factoring Square Matrices

To express a square Galois array (or a permutation of it) as the product of a lower triangular
Galois array and an upper triangular Galois array, use the function. This function accepts
one input argument and produces exactly two or three output arguments. It behaves like the
ordinary MATLAB function when given the same syntax. The example below illustrates
how to factor using .

Solving Linear Equations

To find a particular solution of a linear equation in a Galois field, use the or operator on
Galois arrays. The table below indicates the equation that each operator addresses, assuming
that and are previously defined Galois arrays.

Backslash Operator (\) Slash Operator (/)

Linear Equation

Syntax

Equivalent Syntax Using \ Not applicable

The results of the syntax in the table depend on characteristics of the Galois array A:

If is square and nonsingular, then the output is the unique solution to the linear
equation.
If is square and singular, then the syntax in the table produces an error.
If is not square, then MATLAB attempts to find a particular solution. If or
is a singular array, or if is a tall matrix that represents an overdetermined
system, then the attempt might fail.
Note An error message does not necessarily indicate that the linear equation has
no solution. You might be able to find a solution by rephrasing the problem. For
example, produces an error but the
mathematically equivalent does not. The first
syntax fails because is a singular square matrix.

Example: Solving Linear Equations. The examples below illustrate how to find particular
solutions of linear equations over a Galois field.

The output from this example indicates that the validity checks are all true ( ), except for ,
which is false ( ).

Signal Processing Operations in Galois Fields


You can perform some signal-processing operations on Galois arrays, such as filtering,
convolution, and the discrete Fourier transform. This section describes how to perform these
operations. Other information about the corresponding operations for ordinary real vectors is in
the Signal Processing Toolbox documentation.

Filtering

To filter a Galois vector, use the function. It behaves like the ordinary MATLAB
function when given exactly three input arguments. The code and diagram below
give the impulse response of a particular filter over GF(2).

Convolution

This toolbox offers two equivalent ways to convolve a pair of Galois vectors:
Use the function, as described in Multiplication and Division of Polynomials. This
works because convolving two vectors is equivalent to multiplying the two polynomials
whose coefficients are the entries of the vectors.
Use the function to compute the convolution matrix of one of the vectors,
and then multiply that matrix by the other vector. This works because convolving two
vectors is equivalent to filtering one of the vectors by the other. The equivalence
permits the representation of a digital filter as a convolution matrix, which you can then
multiply by any Galois vector of appropriate length.

Tip If you need to convolve large Galois vectors, then multiplying by the
convolution matrix might be faster than using .

Example. The example below computes the convolution matrix for a vector in GF(4),
representing the numerator coefficients for a digital filter. It then illustrates the two equivalent
ways to convolve with over the Galois field.

Discrete Fourier Transform

The discrete Fourier transform is an important tool in digital signal processing. This toolbox
offers these tools to help you process discrete Fourier transforms:

, which transforms a Galois vector


, which inverts the discrete Fourier transform on a Galois vector
, which returns a Galois array that you can use to perform or invert the
discrete Fourier transform on a Galois vector

In all cases, the vector being transformed must be a Galois vector of length 2 m-1 in the field
GF(2m). The examples below illustrate the use of these functions. You can check, using the
function, that equals , equals , and equals .
Tip If you have many vectors that you want to transform (in the same field), then it
might be faster to use once and matrix multiplication many times, instead of
using many times.

Polynomials over Galois Fields

You can use Galois vectors to represent polynomials in an indeterminate quantity x, with
coefficients in a Galois field. Form the representation by listing the coefficients of the
polynomial in a vector in order of descending powers of x. For example, the vector

represents the polynomial Ax3 + 1x2 + 0x + (A+1), where

A is a primitive element in the field GF(24).


x is the indeterminate quantity in the polynomial.

You can then use such a Galois vector to perform arithmetic with, evaluate, and find roots of
polynomials. You can also find minimal polynomials of elements of a Galois field.

Addition and Subtraction of Polynomials

To add and subtract polynomials, use the ordinary and operators on equal-length Galois
vectors that represent the polynomials. If one polynomial has lower degree than the other, then
you must pad the shorter vector with zeros at the beginning so that the two vectors have the
same length. The example below shows how to add a degree-one polynomial in x to a
degree-two polynomial in x.
Multiplication and Division of Polynomials

To multiply and divide polynomials, use the and functions on Galois vectors
that represent the polynomials. Multiplication and division of polynomials is equivalent to
convolution and deconvolution of vectors. The function returns the quotient of the
two polynomials as well as the remainder polynomial. Examples are below.

Note that the multiplication and division operators described in Arithmetic in Galois Fields
multiply elements or matrices, but not polynomials.

Evaluating Polynomials

To evaluate a polynomial at an element of a Galois field, use the function. It


behaves like the ordinary MATLAB function when given exactly two input
arguments. The example below illustrates how to evaluate a polynomial at several elements in
a field. It also checks the results using the operators and in the field.
The first element of evaluates the polynomial at and, therefore, returns the polynomial's
constant term of .

Roots of Polynomials

To find the roots of a polynomial in a Galois field, use the function on a Galois vector
that represents the polynomial. This function finds roots that are in the same field that the
Galois vector is in. The number of times an entry appears in the output vector from is
exactly its multiplicity as a root of the polynomial.

Note If the Galois vector is in GF(2m), then the polynomial it represents might have
additional roots in some extension field GF((2m)k). However, does not find
those additional roots or indicate their existence.

The examples below find roots of cubic polynomials in GF(8).

Roots of Binary Polynomials


In the special case of a polynomial having binary coefficients, it is also easy to find roots that
exist in an extension field. This because the elements and have the same unambiguous
representation in all fields of characteristic two. To find roots of a binary polynomial in an
extension field, apply the function to a Galois vector in the extension field whose array
elements are the binary coefficients of the polynomial.

The example below seeks roots of a binary polynomial in various fields.

The roots of the polynomial do not exist in GF(2), so is an empty array. However,
the roots of the polynomial exist in GF(4) as well as in GF(16), so and
are nonempty.

Notice that and are not equal to each other. They differ in these ways:

is a GF(4) array, while is a GF(16) array. MATLAB keeps track


of the underlying field of a Galois array.
The array elements in and differ because they use
representations with respect to different primitive polynomials. For example, (which
represents a primitive element) is an element of the vector because the
default primitive polynomial for GF(4) is the same polynomial that
represents. On the other hand, is not an element of because the
primitive element of GF(16) is not a root of the polynomial that
represents.

Minimal Polynomials

The minimal polynomial of an element of GF(2m) is the smallest-degree nonzero


binary-coefficient polynomial having that element as a root in GF(2m). To find the minimal
polynomial of an element or a column vector of elements, use the function.

The code below finds that the minimal polynomial of is D2 + D + 1 and then checks
that is indeed among the roots of that polynomial in the field GF(16).
To find out which elements of a Galois field share the same minimal polynomial, use the
function

Manipulating Galois Variables

This section describes techniques for manipulating Galois variables or for transferring
information between Galois arrays and ordinary MATLAB arrays.

Note These techniques are particularly relevant if you write M-file functions that
process Galois arrays. For an example of this type of usage, enter
in the Command Window and examine the first several lines of code in the editor
window.

Determining Whether a Variable Is a Galois Array

To find out whether a variable is a Galois array rather than an ordinary MATLAB array, use the
function. An illustration is below.
Extracting Information From a Galois Array

To extract the array elements, field order, or primitive polynomial from a variable that is a
Galois array, append a suffix to the name of the variable. The table below lists the exact
suffixes, which are independent of the name of the variable.

Information Suffix Output Value

Array MATLAB array of type that contains the data


elements values from the Galois array

Field order Integer of type that indicates that the Galois array
is in GF( )

Primitive Integer of type that represents the primitive


polynomial polynomial. The representation is similar to the description
in How Integers Correspond to Galois Field Elements.

Note If the output value is an integer data type and you want to convert it to
for later manipulation, use the function.

The code below illustrates the use of these suffixes. The definition of uses a vector of
binary coefficients of a polynomial to create a Galois array in an extension field. Another part of
the example retrieves the primitive polynomial for the field and converts it to a binary vector
representation having the appropriate number of bits.
Speed and Nondefault Primitive Polynomials

The section Specifying the Primitive Polynomial described how you can represent elements of a
Galois field with respect to a primitive polynomial of your choice. This section describes how
you can increase the speed of computations involving a Galois array that uses a primitive
polynomial other than the default primitive polynomial. The technique is recommended if you
perform many such computations.

The mechanism for increasing the speed is a data file, , that some
computational functions use to avoid performing certain computations repeatedly. To take
advantage of this mechanism for your combination of field order ( ) and primitive polynomial
( ):

1. Navigate in MATLAB to a directory to which you have write permission. You can use
either the function or the Current Directory feature to navigate.
2. Define and as workspace variables. For example:

3. Invoke the function:

The function revises or creates in your current working directory to


include data relating to your combination of field order and primitive polynomial. After you
initially invest the time to invoke , subsequent computations using those values of
and should be faster.

Note If you change your current working directory after invoking , then
you must place on your MATLAB path to ensure that
MATLAB can see it. Do this by using the command to prefix the directory
containing to your MATLAB path. If you have multiple copies
of on your path, then use
to find out where they are and
which one MATLAB is using.

To see how much improves the speed of your computations, you can surround
your computations with the and functions. See the reference page for
an example.
Selected Bibliography for Galois Fields

[1] Blahut, Richard E., Theory and Practice of Error Control Codes, Reading, Mass.,
Addison-Wesley, 1983, p. 105.

[2] Lang, Serge, Algebra, Third Edition, Reading, Mass., Addison-Wesley, 1993.

[3] Lin, Shu and Daniel J. Costello, Jr., Error Control Coding: Fundamentals and Applications,
Englewood Cliffs, N.J., Prentice-Hall, 1983.

[4] van Lint, J. H., Introduction to Coding Theory, New York, Springer-Verlag, 1982.

[5] Wicker, Stephen B., Error Control Systems for Digital Communication and Storage, Upper
Saddle River, N.J., Prentice Hall, 1995.

You might also like