The usual mathematical operators +,-,*,/
operate on
matrices as well as scalars. For A binop B
:
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.
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.
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.
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.
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).
A
or B
is a 1x1. In this case the
operation is performed element-by-element over the
entire matrix. The result is a MxN matrix.
A
or B
is a 1xN. and the other is
MxN. In this instance the operation is performed
element-by-element fashion for each row in the
matrix. The result is a MxN matrix.
A
or B
is a Nx1. and the other is
NxM. In this instance the operation is performed
element-by-element fashion for each column in the
matrix. The result is a NxM matrix.
A
or B
is a 1x1. In this case the
operation is performed element-by-element over the
entire matrix. The result is a MxN matrix.
A
or B
is a 1xN. and the other is
MxN. In this instance the operation is performed
element-by-element fashion for each row in the
matrix. The result is a MxN matrix.
A
or B
is a Nx1. and the other is
NxM. In this instance the operation is performed
element-by-element fashion for each column in the
matrix. The result is a NxM matrix.
A
or B
is a 1x1. In this case the
operation is performed element-by-element over the
entire matrix. The result is a MxN matrix.
A
or B
is a 1xN. and the other is
MxN. In this instance the operation is performed
element-by-element fashion for each row in the
matrix. The result is a MxN matrix.
A
or B
is a Nx1. and the other is
NxM. In this instance the operation is performed
element-by-element fashion for each column in the
matrix. The result is a NxM matrix.
A
or B
is a 1x1. In this case the
operation is performed element-by-element over the
entire matrix. The result is a MxN matrix.
A
or B
is a 1xN. and the other is
MxN. In this instance the operation is performed
element-by-element fashion for each row in the
matrix. The result is a MxN matrix.
A
or B
is a Nx1. and the other is
NxM. In this instance the operation is performed
element-by-element fashion for each column in the
matrix. The result is a NxM matrix.
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.
B./A
. The row and
column dimensions of A
and B
must agree,
unless:
A
or B
is a 1x1. In this case the
operation is performed element-by-element over the
entire matrix. The result is a MxN matrix.
A
or B
is a 1xN. and the other is
MxN. In this instance the operation is performed
element-by-element fashion for each row in the
matrix. The result is a MxN matrix.
A
or B
is a Nx1. and the other is
NxM. In this instance the operation is performed
element-by-element fashion for each column in the
matrix. The result is a NxM matrix.
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.
A'
swaps the rows and columns of A.
For a matrix with complex elements a complex conjugate
transpose is performed.
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:
2./A
is not interpreted as
2. /A
. RLaB is smart enough to group the period with
the `/
'.