14 Arithmetic Operators
If two operands are of different sizes, scalars and singleton dimensions are automatically expanded. Non-singleton dimensions need to match.
| octave | description |
|---|---|
x + y, x - y |
addition, subtraction |
x * y |
matrix multiplication |
x .* y |
element-by-element multiplication |
x / y |
right division, conceptually equivalent to (inverse (y') * x')' |
x ./ y |
element-by-element right division |
x \ y |
left division, conceptually equivalent to inverse (x) * y |
x .\ y |
element-by-element left division |
x ^ y |
power operator |
x .^ y |
element-by-element power operator |
+= -= *= .*= /= |
in-place equivalents of the above operators |
./= \= .\= ^= .^= |
|
-x |
negation |
+x |
unary plus (a no-op) |
x' |
complex conjugate transpose |
x.' |
transpose |
++x --x |
increment / decrement, return new value |
++x x-- |
increment / decrement, return old value |