| Communications Toolbox | ![]() |
To invert a square Galois array, use the inv function. Related is the det function, which computes the determinant of a Galois array. Both inv and det behave like their ordinary MATLAB counterparts, except that they perform computations in the Galois field instead of in the field of complex numbers.
Note A Galois array is singular if and only if its determinant is exactly zero. It is not necessary to consider roundoff errors, as in the case of real and complex arrays. |
The code below illustrates matrix inversion and determinant computation.
m = 4;
randommatrix = gf(randint(4,4,2^m),m);
gfid = gf(eye(4),m);
if det(randommatrix) ~= 0
invmatrix = inv(randommatrix);
check1 = invmatrix * randommatrix;
check2 = randommatrix * invmatrix;
if (isequal(check1,gfid) & isequal(check2,gfid))
disp('inv found the correct matrix inverse.');
end
else
disp('The matrix is not invertible.');
endThe output from this example is either of these two messages, depending on whether the randomly generated matrix is nonsingular or singular.
inv found the correct matrix inverse. The matrix is not invertible.
| Linear Algebra in Galois Fields | Computing Ranks | ![]() |
© 1994-2005 The MathWorks, Inc.