• x and y represent numerical values or variables. |
Operator | Operator name | Syntax |
---|---|---|
+ | Addition | x+y U + V (U and V are m x n matrices) |
- | Subtraction | x-y U + V (U and V are m x n matrices) |
* | Multiplication | x*y U*V (U is an m x n matrix and V is an n x p matrix) |
/ | Division | x/y |
% | Modulus | m%n U + V (U and V are m x n matrices of integer values). This operator operates element-wise on matrices. |
! | Factorial | m! |
^ | Power | x^y |
\ | Left division | x\y is equivalent to (1/x) * y U \ V (U and V are m x n matrices) is equivalent to (1/U) * V |
.* | Element-wise multiplication | U .* V (U and V are m x n matrices) |
./ | Element-wise division | U ./ V (U and V are m x n matrices) |
.\ | Element-wise left division | U .\ V (U and V are m x n matrices) is equivalent to (1/U) .* V |
.^ | Element-wise power | U .^ V (U and V are m x n matrices) |
An Element-wise operator performs an operation on each pair of Elements, which is in the same location, of the operand matrices. |
Operator | Operator name | Syntax |
---|---|---|
= | Assignment | x=y a=b U=V |
Operator | Operator name | Syntax |
---|---|---|
> | Greater | x>y U>V |
< | Less | x<y U<V |
>= | Greater or Equal | x>=y U>=V |
<= | Less of Equal | x<=y U<=V |
== | Equality | x==y a==b U==V |
!= | Inequality | x!=y a!=b U!=V |
All comparison operators operate Element-wise on matrices in the example as follows A = [1; 2; 3] Then |
Operator | Operator Name | Syntax |
---|---|---|
! NOT not | NOT | !A NOT A not A |
& AND and | AND | A&B A AND B A and B |
| OR or | OR | A|B A OR B A or B |
^ XOR xor | XOR (exclusive OR) | A^B A XOR B A xor B |
All boolean operators operate element-wise on matrices in the example as follows A = [true; true; false; false]; Then |