Contenido principal

gfdiv

R2026b

Divide elements of Galois field

Description

quot = gfdiv(b,a) divides b by a in GF(2) element-by-element. Each entry in a and b represents an element of GF(2). for more information, see Galois Field Entries.

example

quot = gfdiv(b,a,p) divides b by a in GF(p) and returns the quotient. p is a prime number.

quot = gfdiv(b,a,field) divides b by a in GF(pm) 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(pm) relative to some primitive element of GF(pm). field is the matrix listing all elements of GF(pm), arranged relative to the same primitive element.

Examples

collapse all

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):')
Inverses in GF(5):
disp('element  inverse')
element  inverse
disp([a, quot1])
     1     1
     2     3
     3     2
     4     4

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')
Inverses in GF(25), expressed in EXPONENTIAL FORMAT with
disp('respect to a root of the default primitive polynomial:')
respect to a root of the default primitive polynomial:
disp('element  inverse')
element  inverse
disp([a, quot2])
     0     0
     1    23
     2    22
     3    21
     4    20
     5    19
     6    18
     7    17
     8    16
     9    15
    10    14
    11    13
    12    12
    13    11
    14    10
    15     9
    16     8
    17     7
    18     6
    19     5
    20     4
    21     3
    22     2
    23     1

Input Arguments

collapse all

Galois field, specified as a row vector, character vector, or string. For more information, see Representation of Polynomials in Communications Toolbox.

Galois field, specified as a row vector, character vector, or string. a and b must be the same size. For more information, see Representation of Polynomials in Communications Toolbox.

Prime number, specified as a scalar. Each entry in a and b represents an element of GF(p).

Data Types: double

List of all elements in GF(pm), specified as a matrix arranged relative to the same primitive element. a and b must be the same size.

To generate field, use

field =gftuple([-1:p^m-2]',m,p)
where m is a positive integer and p is a prime number. The coefficients, specified in exponential format, represent the field elements in GF(pm). For an explanation of these formats, see Representing Elements of Galois Fields.

Data Types: double

Output Arguments

collapse all

Galois field polynomial, returned as a row vector of the polynomial coefficients in order of ascending powers.

More About

collapse all

Tips

  • This function divides elements of a Galois field. In all cases, an attempt to divide by the zero element of the field results in a quotient, quot, of NaN.

  • This function performs computations in GF(pm), where p is prime.

  • To work in GF(2m), you can also apply the ./ operator to Galois arrays. For more information, see Example: Division.

Version History

Introduced before R2006a