Logical Operators (MATRIX-END MATRIX command)

Logical operators combine two matrices, normally containing values of 1 (true) or 0 (false). When used with other numerical matrices, they treat all positive values as true and all negative and 0 values as false. The logical operators are:

NOT. Reverses the truth of the matrix that follows it. Positive elements yield 0, and negative or 0 elements yield 1.

AND. Both must be true. The matrix A AND B is 1 where the corresponding elements of A and B are both positive and 0 elsewhere.

OR. Either must be true. The matrix A OR B is 1 where the corresponding element of either A or B is positive and 0 where both elements are negative or 0.

XOR. Either must be true but not both. The matrix A XOR B is 1 where one but not both of the corresponding elements of A and B is positive and 0 where both are positive or neither is positive.