Communications Toolbox    

Logical Operations in Galois Fields

You can apply logical tests to Galois arrays and obtain a logical array. Some important types of tests are testing for equality of two Galois arrays and testing for nonzero values in a Galois array.

Testing for Equality

To compare corresponding elements of two Galois arrays that have the same size, use the operators == and ~=. The result is a logical array, each element of which indicates the truth or falsity of the corresponding elementwise comparison. If you use the same operators to compare a scalar with a Galois array, then MATLAB compares the scalar with each element of the array, producing a logical array of the same size.

The output is below.

Comparison of isequal and ==.   To compare entire arrays and obtain a logical scalar result rather than a logical array, you can use the built-in isequal function. Note, however, that isequal uses strict rules for its comparison, and returns a value of 0 (false) if you compare

The example below illustrates this difference between == and isequal.

Testing for Nonzero Values

To test for nonzero values in a Galois vector, or in the columns of a Galois array that has more than one row, use the any or all function. These two functions behave just like the ordinary MATLAB functions any and all, except that they consider only the underlying array elements while ignoring information about which Galois field the elements are in. Examples are below.


  Arithmetic in Galois Fields Matrix Manipulation in Galois Fields