| Communications Toolbox | ![]() |
Solve the linear equation Ax = b over a prime Galois field
Syntax
x = gflineq(A,b); x = gflineq(A,b,p); [x,vld] = gflineq(...);
Description
x = gflineq(A,b)
returns a particular solution of the linear equation A x = b over GF(2). If A is a k-by-n matrix and b is a vector of length k, then x is a vector of length n. Each entry of A, x, and b is either 0 or 1. If no solution exists, then x is empty.
x = gflineq(A,b,p)
returns a particular solution of the linear equation A x = b over GF(p), where p is a prime number. If A is a k-by-n matrix and b is a vector of length k, then x is a vector of length n. Each entry of A, x, and b is an integer between 0 and p-1.
[x,vld] = gflineq(...)
returns a flag vld that indicates the existence of a solution. If vld = 1, then the solution x exists and is valid; if vld = 0, then no solution exists.
Examples
The code below produces some valid solutions of a linear equation over GF(2).
A=[1 0 1;
1 1 0;
1 1 1];
% An example in which the solutions are valid
[x,vld] = gflineq(A,[1;0;0])
x =
1
1
0
vld =
1
By contrast, the command below finds that the linear equation has no solutions.
[x2,vld2] = gflineq(zeros(3,3),[1;0;0])
This linear equation has no solution.
x2 =
[]
vld2 =
0
Algorithm
gflineq uses Gaussian elimination.
See Also
gfrank, gfadd, gfdiv, gfroots, gfconv, conv
| gffilter | gfminpol | ![]() |