<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of Matrix Operations</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">
<LINK REL="STYLESHEET" HREF="rlabp_tex.css">
<LINK REL="next" HREF="node26_mn.html"> <LINK REL="previous" HREF="node24_mn.html"> <LINK REL="up" HREF="node19_mn.html"> <LINK REL="next" HREF="node26_mn.html"> </HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">
<H3><A ID="SECTION00063600000000000000"> Matrix Operations</A> </H3>
<P> The usual mathematical operators <code>+,-,*,/</code> operate on matrices as well as scalars. For <code>A binop B</code>:
<P> <DL> <DT><STRONG><TT>+</TT></STRONG></DT> <DD>Does element-by-element addition of two matrices. The row and column dimensions of both <code>A</code> and <code>B</code> must be the same. An exception to the aforementioned rule occurs when either <code>A</code> or <code>B</code> is a 1-by-1 matrix; in this case a scalar-matrix addition operation is performed.
<P> </DD> <DT><STRONG><TT>-</TT></STRONG></DT> <DD>Does element-by-element subtraction of two matrices. The row and column dimensions of both <code>A</code> and <code>B</code> must be the same. An exception to the aforementioned rule occurs when either <code>A</code> or <code>B</code> is a 1-by-1 matrix; in this case a scalar-matrix addition operation is performed.
<P> </DD> <DT><STRONG><TT>*</TT></STRONG></DT> <DD>Performs matrix multiplication on the two operands. The column dimension of <code>A</code> must match the row dimension of <code>B</code>. An exception to the aforementioned rule occurs when either <code>A</code> or <code>B</code> is a 1-by-1 matrix; in this case a scalar-matrix multiplication is performed.
<P> </DD> <DT><STRONG><TT>/</TT></STRONG></DT> <DD>Performs matrix ``right-division'' on its operands. The matrix right-division (<code>B/A</code>) can be thought of as <code>B*inv (A)</code>. The column dimensions of <code>A</code> and <code>B</code> must be the same. Internally right division is the same as ``left-division'' with the arguments transposed.
<P> <P><!– MATH
<P> The exception to the aforementioned dimension rule occurs when <code>A</code> is a 1-by-1 matrix; in this case a matrix-scalar divide occurs.
<P> </DD> </DL>
<P> Additionally, RLaB has several other operators that function on matrix operand(s).
<P> <DL> <DT><STRONG><TT>.+</TT></STRONG></DT> <DD>Performs element-by-element addition on its operands. The operands must have the same row and column dimensions. <EM>Unless</EM>:
<P>
<UL> <LI><code>A</code> or <code>B</code> is a 1x1. In this case the operation is performed element-by-element over the entire matrix. The result is a MxN matrix.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> </UL>
<P> </DD> <DT><STRONG><TT>.-</TT></STRONG></DT> <DD>Performs element-by-element subtraction on its operands. The operands must have the same row and column dimensions. <EM>Unless</EM>:
<P>
<UL> <LI><code>A</code> or <code>B</code> is a 1x1. In this case the operation is performed element-by-element over the entire matrix. The result is a MxN matrix.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> </UL>
<P> </DD> <DT><STRONG><TT>.*</TT></STRONG></DT> <DD>Performs element-by-element multiplication on its operands. The operands must have the same row and column dimensions. <EM>Unless</EM>:
<P>
<UL> <LI><code>A</code> or <code>B</code> is a 1x1. In this case the operation is performed element-by-element over the entire matrix. The result is a MxN matrix.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> </UL>
<P> </DD> <DT><STRONG><TT>./</TT></STRONG></DT> <DD>Performs element-by-element division on its operands. The operands must have the same row and column dimensions. <EM>Unless</EM>:
<P>
<UL> <LI><code>A</code> or <code>B</code> is a 1x1. In this case the operation is performed element-by-element over the entire matrix. The result is a MxN matrix.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> </UL>
<P>
</DD>
<DT><STRONG><IMG
STYLE="height: 2.36ex; vertical-align: 160.80ex; " SRC="img6.png"
ALT=""></STRONG></DT>
<DD>Performs matrix ``left-division''. Given
operands <code>A</code> matrix left division is the
solution to the set of equations <I>Ax</I> = <I>B</I>. If <I>B</I> has
several columns, then each column of <I>x</I> is a solution
to <code>A*x[;i] = B[;i]</code>. The row dimensions of
<code>A</code> and <code>B</code> must agree.
<P>
</DD>
<DT><STRONG><!– MATH
.
–>
. <IMG
STYLE="height: 2.36ex; vertical-align: 160.80ex; " SRC="img6.png"
ALT="
"></STRONG></DT>
<DD>Performs element-by-element left-division.
Element-by-element left-division is provided for
symmetry, and is equivalent to <code>B./A</code>. The row and
column dimensions of <code>A</code> and <code>B</code> must agree,
<EM>unless</EM>:
<P>
<UL> <LI><code>A</code> or <code>B</code> is a 1x1. In this case the operation is performed element-by-element over the entire matrix. The result is a MxN matrix.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> <LI><code>A</code> or <code>B</code> 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.
<P> </LI> </UL>
<P> </DD> <DT><STRONG><!– MATH ∧ –> <SUP>∧</SUP></STRONG></DT> <DD><code>A^B</code> raises <code>A</code> to the <code>B</code> power. When <code>A</code> is a matrix, and <code>B</code> is an integer scalar, the operation is performed by successive multiplications. When <code>B</code> is not an integer, then the operation is performed via <code>A</code>'s eigenvalues and eigenvectors. The operation is not allowed if <code>B</code> is a matrix.
<P> </DD> <DT><STRONG><!– MATH .∧ –> .<SUP>∧</SUP></STRONG></DT> <DD><code>A.^B</code> raises <code>A</code> to the <code>B</code> power in an element-by-element fashion. Either <code>A</code> or <code>B</code> can be matrix or scalar. If both <code>A</code> and <code>B</code> are matrix, then the row and column dimensions must agree.
<P> </DD> <DT><STRONG><TT>'</TT></STRONG></DT> <DD>This unary operator performs the matrix transpose operation. <code>A'</code> swaps the rows and columns of A. For a matrix with complex elements a complex conjugate transpose is performed.
<P> </DD> <DT><STRONG><TT>.'</TT></STRONG></DT> <DD>This unary operator performs the matrix transpose operation. <code>A.'</code> swaps the rows and columns of A. The difference between <code>'</code> and <code>.'</code> is only apparent when <code>A</code> is a complex matrix; then <code>A.'</code> does not perform a complex conjugate transpose.
<P> </DD> </DL>
<P> Several details are important to note:
<P>
<UL> <LI>The two character operators are just that, two characters. White space, or any other character in between the two symbols is an error, or may be interpreted differently.
<P> </LI> <LI>The expression <code>2./A</code> is <B>not</B> interpreted as <code>2. /A</code>. RLaB is smart enough to group the period with the `<code>/</code>'.
<P> </LI> </UL>
<P>
<HR>
</BODY> </HTML>