Relational Operators (MATRIX-END MATRIX command)

The relational operators are used to compare two matrices, element by element. The result is a matrix of the same size as the (expanded) operands and containing either 1 or 0. The value of each element, 1 or 0, is determined by whether the comparison between the corresponding element of the first matrix with the corresponding element of the second matrix is true or false--1 for true and 0 for false. The matrices being compared must be of the same dimensions unless one of them is a scalar. The relational operators are listed in the following table.

Table 1. Relational operators in matrix programs
Symbol Keyword Definition
> GT Greater than
< LT Less than
<> or ~= (¬=) NE Not equal to
<= LE Less than or equal to
>= GE Greater than or equal to
= EQ Equal to
  • The symbolic and alphabetic forms of these operators are equivalent.
  • The symbols representing NE (~= or ¬=) are system dependent. In general, the tilde (~) is valid for ASCII systems, while the logical-not sign (¬), or whatever symbol is over the number 6 on the keyboard, is valid for IBM EBCDIC systems.
  • Use these operators only with numeric matrices. The results are undefined when they are used with string matrices.