Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Divide elements of Galois field

`quot = gfdiv(b,a)`

quot = gfdiv(b,a,p)

quot = gfdiv(b,a,field)

This function performs computations in GF(p^{m}),
where p is prime. To work in GF(2^{m}), apply
the `./`

operator to Galois arrays. For details,
see Example: Division.

The `gfdiv`

function divides elements of a
Galois field. (To divide polynomials over a Galois field, use `gfdeconv`

instead.)

`quot = gfdiv(b,a)`

divides `b`

by `a`

in
GF(2) element-by-element. `a`

and `b`

are
scalars, vectors or matrices of the same size. Each entry in `a`

and `b`

represents
an element of GF(2). The entries of `a`

and `b`

are
either 0 or 1.

`quot = gfdiv(b,a,p)`

divides
b by a in GF(`p`

) and returns the quotient. `p`

is
a prime number. If `a`

and `b`

are
matrices of the same size, the function treats each element independently.
All entries of `b`

, `a`

, and `quot`

are
between 0 and `p`

-1.

`quot = gfdiv(b,a,field)`

divides `b`

by `a`

in
GF(p^{m}) and returns the quotient. p is a
prime number and m is a positive integer. If `a`

and `b`

are
matrices of the same size, then the function treats each element independently.
All entries of `b`

, `a`

, and `quot`

are
the exponential formats of elements of GF(p^{m})
relative to some primitive element of GF(p^{m}). `field`

is
the matrix listing all elements of GF(p^{m}),
arranged relative to the same primitive element. See Representing Elements of Galois Fields for
an explanation of these formats.

In all cases, an attempt to divide by the zero element of the
field results in a “quotient” of `NaN`

.

The code below displays
lists of multiplicative inverses in GF(5) and GF(25). It uses column
vectors as inputs to `gfdiv`

.

% Find inverses of nonzero elements of GF(5). p = 5; b = ones(p-1,1); a = [1:p-1]'; quot1 = gfdiv(b,a,p); disp('Inverses in GF(5):') disp('element inverse') disp([a, quot1]) % Find inverses of nonzero elements of GF(25). m = 2; field = gftuple([-1:p^m-2]',m,p); b = zeros(p^m-1,1); % Numerator is zero since 1 = alpha^0. a = [0:p^m-2]'; quot2 = gfdiv(b,a,field); disp('Inverses in GF(25), expressed in EXPONENTIAL FORMAT with') disp('respect to a root of the default primitive polynomial:') disp('element inverse') disp([a, quot2])

Was this topic helpful?