Next: Matrix Multiplication Operator ‘*’, Previous: Unary Operators, Up: Matrix Expressions [Contents][Index]
The elementwise binary operators require their operands to be matrices with the same dimensions. Alternatively, if one operand is a scalar, then its value is treated as if it were duplicated to the dimensions of the other operand. The result is a matrix of the same size as the operands, in which each element is the result of the applying the operator to the corresponding elements of the operands.
The elementwise binary operators are listed below.
+Addition.
-Subtraction.
*Multiplication, if one operand is a scalar. (Otherwise this is matrix multiplication, described below.)
/ or &/Division.
&*Multiplication.
&**Exponentiation.
< or LTLess than.
<= or LELess than or equal.
= or EQEqual.
> or GTGreater than.
>= or GEGreater than or equal.
<> or ~= or NENot equal.
ANDTrue if both operands are true.
ORTrue if at least one operand is true.
XORTrue if exactly one operand is true.
Examples:
| 1 + 2 | ⇒ | 3 |
| 1 + {3; 4} | ⇒ | {4; 5} |
| {66, 77; 88, 99} + 5 | ⇒ | {71, 82; 93, 104} |
| {4, 8; 3, 7} + {1, 0; 5, 2} | ⇒ | {5, 8; 8, 9} |
| {1, 2; 3, 4} < {4, 3; 2, 1} | ⇒ | {1, 1; 0, 0} |
| {1, 3; 2, 4} >= 3 | ⇒ | {0, 1; 0, 1} |
| {0, 0; 1, 1} AND {0, 1; 0, 1} | ⇒ | {0, 0; 0, 1} |
Next: Matrix Multiplication Operator ‘*’, Previous: Unary Operators, Up: Matrix Expressions [Contents][Index]