| Communications Toolbox | ![]() |
To find a particular solution of a linear equation in a Galois field, use the \ or / operator on Galois arrays. The table below indicates the equation that each operator addresses, assuming that A and B are previously defined Galois arrays.
| Operator | Linear Equation | Syntax | Equivalent Syntax Using \ |
|---|---|---|---|
| Backslash (\) | A * x = B | x = A \ B | Not applicable |
| Slash (/) | x * A = B | x = B / A | x = (A'\B')' |
The results of the syntax in the table depend on characteristics of the Galois array A:
If A is square and nonsingular, then the output x is the unique solution to the linear equation.
If A is square and singular, then the syntax in the table produces an error.
If A is not square, then MATLAB attempts to find a particular solution. If A'*A or A*A' is a singular array, or if A is a tall matrix that represents an overdetermined system, then the attempt might fail.
Note An error message does not necessarily indicate that the linear equation has no solution. You might be able to find a solution by rephrasing the problem. For example, gf([1 2; 0 0],3) \ gf([1; 0],3) produces an error but the mathematically equivalent gf([1 2],3) \ gf([1],3) does not. The first syntax fails because gf([1 2; 0 0],3) is a singular square matrix. |
The examples below illustrate how to find particular solutions of linear equations over a Galois field.
m = 4; A = gf(magic(3),m); % Square nonsingular matrix Awide=[A, 2*A(:,3)]; % 3-by-4 matrix with redundancy on the right Atall = Awide'; % 4-by-3 matrix with redundancy at the bottom B = gf([0:2]',m); C = [B; 2*B(3)]; D = [B; B(3)+1]; thesolution = A \ B; % Solution of A * x = B thesolution2 = B' / A; % Solution of x * A = B' ck1 = all(A * thesolution == B) % Check validity of solutions. ck2 = all(thesolution2 * A == B') % Awide * x = B has infinitely many solutions. Find one. onesolution = Awide \ B; ck3 = all(Awide * onesolution == B) % Check validity of solution. % Atall * x = C has a solution. asolution = Atall \ C; ck4 = all(Atall * asolution == C) % Check validity of solution. % Atall * x = D has no solution. notasolution = Atall \ D; ck5 = all(Atall * notasolution == D) % It is not a valid solution.
The output from this example indicates that the validity checks are all true (1), except for ck5, which is false (0).
| Factoring Square Matrices | Signal Processing Operations in Galois Fields | ![]() |
© 1994-2005 The MathWorks, Inc.