Main Content


Produce cyclotomic cosets for Galois field


c = gfcosets(m)
c = gfcosets(m,p)



This function performs computations in GF(pm), where p is prime. To work in GF(2m), use the cosets function.

c = gfcosets(m) produces cyclotomic cosets mod(2m - 1). Each row of the output GFCS contains one cyclotomic coset.

c = gfcosets(m,p) produces the cyclotomic cosets for GF(p^m), where m is a positive integer and p is a prime number.

The output matrix c is structured so that each row represents one coset. The row represents the coset by giving the exponential format of the elements of the coset, relative to the default primitive polynomial for the field. For a description of exponential formats, see Representing Elements of Galois Fields.

The first column contains the coset leaders. Because the lengths of cosets might vary, entries of NaN are used to fill the extra spaces when necessary to make c rectangular.

A cyclotomic coset is a set of elements that all satisfy the same minimal polynomial. For more details on cyclotomic cosets, see the works listed in References.


The command below finds the cyclotomic cosets for GF(9).

c = gfcosets(2,3)

The output is

c =

     0   NaN
     1     3
     2     6
     4   NaN
     5     7

The gfminpol function can check that the elements of, for example, the third row of c indeed belong in the same coset.

m = [gfminpol(2,2,3); gfminpol(6,2,3)] % Rows are identical.

The output is

m =

     1     0     1
     1     0     1


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

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

Version History

Introduced before R2006a