Documentation Center |
pol = gfprimfd(m,opt,p)
Note: This function performs computations in GF(p^{m}), where p is prime. To work in GF(2^{m}), use the primpoly function. For details, see Finding Primitive Polynomials. |
If m = 1, pol = [1 1].
A polynomial is represented as a row containing the coefficients in order of ascending powers.
pol = gfprimfd(m,opt,p) searches for one or more primitive polynomials for GF(p^m), where p is a prime number and m is a positive integer. If m = 1, pol = [1 1]. If m > 1, the output pol depends on the argument opt as shown in the table below. Each polynomial is represented in pol as a row containing the coefficients in order of ascending powers.
opt | Significance of pol | Format of pol |
---|---|---|
'min' | One primitive polynomial for GF(p^m) having the smallest possible number of nonzero terms | The row vector representing the polynomial |
'max' | One primitive polynomial for GF(p^m) having the greatest possible number of nonzero terms | The row vector representing the polynomial |
'all' | All primitive polynomials for GF(p^m) | A matrix, each row of which represents one such polynomial |
A positive integer | All primitive polynomials for GF(p^m) that have opt nonzero terms | A matrix, each row of which represents one such polynomial |
The code below seeks primitive polynomials for GF(81) having various other properties. Notice that fourterms is empty because no primitive polynomial for GF(81) has exactly four nonzero terms. Also notice that fewterms represents a single polynomial having three terms, while threeterms represents all of the three-term primitive polynomials for GF(81).
p = 3; m = 4; % Work in GF(81). fewterms = gfprimfd(m,'min',p) threeterms = gfprimfd(m,3,p) fourterms = gfprimfd(m,4,p)
The output is below.
fewterms = 2 1 0 0 1 threeterms = 2 1 0 0 1 2 2 0 0 1 2 0 0 1 1 2 0 0 2 1 No primitive polynomial satisfies the given constraints. fourterms = []