gf
Galois field array
Description
Examples
Create GF(2) Array from Specified Matrix
Specify a matrix of 0
s and 1
s.
x = [0 1 1; 0 1 0; 1 1 1];
Create a GF(2) array from x
.
x_gf = gf(x)
x_gf = GF(2) array. Array elements = 0 1 1 0 1 0 1 1 1
Create Sequence of GF(16) Elements
Set the order of the Galois field to 16, where the order equals . Specify a matrix of elements that range from 0 to . Create the Galois field array.
m = 4; x = [3 2 9; 1 2 1]; y = gf(x,m)
y = GF(2^4) array. Primitive polynomial = D^4+D+1 (19 decimal) Array elements = 3 2 9 1 2 1
Create GF Sequence with Specified Primitive Polynomial
Create a sequence of integers. Create a Galois field array in GF().
x = [17 8 11 27]; y = gf(x,5)
y = GF(2^5) array. Primitive polynomial = D^5+D^2+1 (37 decimal) Array elements = 17 8 11 27
Determine all possible primitive polynomials for GF().
pp = primpoly(5,'all')
Primitive polynomial(s) = D^5+D^2+1 D^5+D^3+1 D^5+D^3+D^2+D^1+1 D^5+D^4+D^2+D^1+1 D^5+D^4+D^3+D^1+1 D^5+D^4+D^3+D^2+1
pp = 6×1
37
41
47
55
59
61
Create a Galois field array using the primitive polynomial that has a decimal equivalent of 59.
z = gf(x,5,'D5+D4+D3+D+1')
z = GF(2^5) array. Primitive polynomial = D^5+D^4+D^3+D+1 (59 decimal) Array elements = 17 8 11 27
Check Galois Generator Polynomial Validity
Use the genpoly2b
function to return the corresponding Galois field array value and the generator polynomial validity indication.
Create a valid Galois field array object.
genpoly = gf([1 1 6],3)
genpoly = GF(2^3) array. Primitive polynomial = D^3+D+1 (11 decimal) Array elements = 1 1 6
[b,ecode] = genpoly2b(genpoly,3,11)
b = 1
ecode = 1
Input Arguments
x
— Input matrix
matrix with all values greater than or equal to zero
Input matrix, specified as a matrix with values greater than or equal to zero. The function uses this value to create a GF array.
Data Types: double
m
— Order of primitive polynomial
positive integer
Order of primitive polynomial, specified as a positive integer from 1 through 16. The function uses this value to calculate the distinct number of elements in the GF.
Data Types: double
prim_poly
— Primitive polynomial
primitive polynomial in
GF(2m
) (default) | binary row vector | character vector | string scalar | positive integer
Primitive polynomial, specified as one of these options:
Binary row vector — This vector specifies coefficients of
prim_poly
in the order of ascending powers.Character vector or a string scalar — This value defines
prim_poly
in a textual representation. For more details, refer to polynomial character vector.Positive integer — This value defines
prim_poly
in the range [(2m + 1), (2m+1 – 1)].
If prim_poly
is not specified, see Default Primitive Polynomials for the list of default primitive
polynomial used for each Galois field array
GF(2m
).
Data Types: double
| char
| string
Output Arguments
x_gf
— Galois field array
variable that MATLAB recognizes as a Galois field array
Galois field array, returned as a variable that MATLAB recognizes as a Galois field
array, rather than an array of integers. As a result, when you manipulate the variable,
MATLAB works within the Galois field the variable specifies. For example, if you apply
the log
function to a Galois array, MATLAB computes the
logarithm in the Galois field for that Galois array and not in the field of real or
complex numbers.
More About
Default Primitive Polynomials
This table lists the default primitive polynomial used for each Galois field
array GF(2m
). To use a different primitive
polynomial, specify prim_poly
as an input argument.
prim_poly
must be in the range
[(2m
+ 1),
(2m
+1 – 1)] and must indicate an
irreducible polynomial. For more information, see Primitive Polynomials and Element Representations.
Value of m | Default Primitive Polynomial | Integer Representation |
---|---|---|
1 | D + 1 | 3 |
2 | D2 + D + 1 | 7 |
3 | D3 + D + 1 | 11 |
4 | D4 + D + 1 | 19 |
5 | D5 + D2 + 1 | 37 |
6 | D6 + D + 1 | 67 |
7 | D7 + D3 + 1 | 137 |
8 | D8 + D4 + D3 + D2 + 1 | 285 |
9 | D9 + D4 + 1 | 529 |
10 | D10 + D3 + 1 | 1033 |
11 | D11 + D2 + 1 | 2053 |
12 | D12 + D6 + D4 + D + 1 | 4179 |
13 | D13 + D4 + D3 + D + 1 | 8219 |
14 | D14 + D10 + D6 + D + 1 | 17475 |
15 | D15 + D + 1 | 32771 |
16 | D16 + D12 + D3 + D + 1 | 69643 |
Galois Computations
This table lists the operations supported for Galois field arrays.
Operation | Description |
---|---|
+ - | Addition and subtraction of Galois arrays |
* / \ | Matrix multiplication and division of Galois arrays |
.* ./ .\ | Elementwise multiplication and division of Galois arrays |
^ | Matrix exponentiation of Galois array |
.^ | Elementwise exponentiation of Galois array |
' .' | Transpose of Galois array |
==, ~= | Relational operators for Galois arrays |
all | True if all elements of a Galois vector are nonzero |
any | True if any element of a Galois vector is nonzero |
conv | Convolution of Galois vectors |
convmtx | Convolution matrix of Galois field vector |
deconv | Deconvolution and polynomial division |
det | Determinant of square Galois matrix |
dftmtx | Discrete Fourier transform matrix in a Galois field |
diag | Diagonal Galois matrices and diagonals of a Galois matrix |
fft | Discrete Fourier transform |
filter (gf) | One-dimensional digital filter over a Galois field |
ifft | Inverse discrete Fourier transform |
inv | Inverse of Galois matrix |
length | Length of Galois vector |
log | Logarithm in a Galois field |
lu | Lower-Upper triangular factorization of Galois array |
minpol | Find the minimal polynomial for a Galois element |
mldivide | Matrix left division \ of Galois arrays |
polyval | Evaluate polynomial in Galois field |
rank | Rank of a Galois array |
reshape | Reshape Galois array |
roots | Find polynomial roots across a Galois field |
size | Size of Galois array |
tril | Extract lower triangular part of Galois array |
triu | Extract upper triangular part of Galois array |
Version History
Introduced before R2006a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)