| Communications Toolbox | ![]() |
Find the roots of a polynomial over a prime Galois field
Syntax
rt = gfroots(f); rt = gfroots(f,m); rt = gfroots(f,primpoly); rt = gfroots(f,m,p); rt = gfroots(f,primpoly,p); [rt,rt_tuple] = gfroots(...); [rt,rt_tuple,field] = gfroots(...);
Description
For all syntaxes, f is a row vector that gives the coefficients, in order of ascending powers, of a degree-d polynomial.
rt = gfroots(f)
finds roots in GF(2d) of the polynomial that f represents. rt is a column vector each of whose entries is the exponential format of a root. The exponential format is relative to a root of the default primitive polynomial for GF(2d).
rt = gfroots(f,m)
finds roots in GF(2m) of the polynomial that f represents. m is an integer greater than or equal to d. rt is a column vector each of whose entries is the exponential format of a root. The exponential format is relative to a root of the default primitive polynomial for GF(2m).
rt = gfroots(f,primpoly)
finds roots in GF(2m) of the polynomial that f represents. rt is a column vector each of whose entries is the exponential format of a root. The exponential format is relative to a root of the degree-m primitive polynomial for GF(2m) that primpoly represents. m is an integer greater than or equal to d.
rt = gfroots(f,m,p)
is the same as rt = gfroots(f,m) except that 2 is replaced by a prime number p.
rt = gfroots(f,primpoly,p)
is the same as rt = gfroots(f,primpoly) except that 2 is replaced by a prime number p.
[rt,rt_tuple] = gfroots(...)
returns an additional matrix rt_tuple, whose kth row is the polynomial format of the root rt(k). The polynomial and exponential formats are both relative to the same primitive element.
[rt,rt_tuple,field] = gfroots(...)
returns additional matrices rt_tuple and field. rt_tuple is described in the paragraph above. field gives the list of elements of the extension field. The list of elements, the polynomial format, and the exponential format are all relative to the same primitive element.
Note
For a description of the various formats that gfroots uses, see Representing Elements of Galois Fields.
|
Examples
The section, Roots of Polynomials, contains a description and example of the use of gfroots.
As another example, the code below finds the polynomial format of the roots of the primitive polynomial 1 + x3 + x4 for GF(16). It then displays the roots in traditional form as polynomials in alpha. Since primpoly is both the primitive polynomial and the polynomial whose roots are sought, alpha itself is a root.
p = 2; m = 4; primpoly = [1 0 0 1 1]; % A primitive polynomial for GF(16) f = primpoly; % Find roots of the primitive polynomial. [rt,rt_tuple] = gfroots(f,primpoly,p); % Display roots as polynomials in alpha. for ii = 1:length(rt_tuple) gfpretty(rt_tuple(ii,:),'alpha') end
| gfrepcov | gfsub | ![]() |