Matrix Operations

The usual mathematical operators +,-,*,/ operate on matrices as well as scalars. For A binop B:

+
Does element-by-element addition of two matrices. The row and column dimensions of both A and B must be the same. An exception to the aforementioned rule occurs when either A or B is a 1-by-1 matrix; in this case a scalar-matrix addition operation is performed.

-
Does element-by-element subtraction of two matrices. The row and column dimensions of both A and B must be the same. An exception to the aforementioned rule occurs when either A or B is a 1-by-1 matrix; in this case a scalar-matrix addition operation is performed.

*
Performs matrix multiplication on the two operands. The column dimension of A must match the row dimension of B. An exception to the aforementioned rule occurs when either A or B is a 1-by-1 matrix; in this case a scalar-matrix multiplication is performed.

/
Performs matrix ``right-division'' on its operands. The matrix right-division (B/A) can be thought of as B*inv (A). The column dimensions of A and B must be the same. Internally right division is the same as ``left-division'' with the arguments transposed.

B/A = (AT $\displaystyle \setminus$ BT)T

The exception to the aforementioned dimension rule occurs when A is a 1-by-1 matrix; in this case a matrix-scalar divide occurs.

Additionally, RLaB  has several other operators that function on matrix operand(s).

.+
Performs element-by-element addition on its operands. The operands must have the same row and column dimensions. Unless:

.-
Performs element-by-element subtraction on its operands. The operands must have the same row and column dimensions. Unless:

.*
Performs element-by-element multiplication on its operands. The operands must have the same row and column dimensions. Unless:

./
Performs element-by-element division on its operands. The operands must have the same row and column dimensions. Unless:

$\setminus$
Performs matrix ``left-division''. Given operands A\B matrix left division is the solution to the set of equations Ax = B. If B has several columns, then each column of x is a solution to A*x[;i] = B[;i]. The row dimensions of A and B must agree.

. $\setminus$
Performs element-by-element left-division. Element-by-element left-division is provided for symmetry, and is equivalent to B./A. The row and column dimensions of A and B must agree, unless:

A^B raises A to the B power. When A is a matrix, and B is an integer scalar, the operation is performed by successive multiplications. When B is not an integer, then the operation is performed via A's eigenvalues and eigenvectors. The operation is not allowed if B is a matrix.

.
A.^B raises A to the B power in an element-by-element fashion. Either A or B can be matrix or scalar. If both A and B are matrix, then the row and column dimensions must agree.

'
This unary operator performs the matrix transpose operation. A' swaps the rows and columns of A. For a matrix with complex elements a complex conjugate transpose is performed.

.'
This unary operator performs the matrix transpose operation. A.' swaps the rows and columns of A. The difference between ' and .' is only apparent when A is a complex matrix; then A.' does not perform a complex conjugate transpose.

Several details are important to note: