Unit 1.4.3 Row-times-matrix multiplication
ΒΆAn operation that is closely related to matrix-vector multiplication is the multipication of a row times a matrix, which in the setting of this course updates a row vector:
\begin{equation*}
y^T := x^T A + y^T.
\end{equation*}
If we partition \(A \) by columns and \(y^T \) by elements, we get
\begin{equation*}
\begin{array}{l}
\left( \begin{array}{c | c | c | c}
\psi_0 \amp \psi_1 \amp \cdots \amp \psi_{n-1}
\end{array} \right)
:=
x^T
\left( \begin{array}{c|c|c|c}
a_0 \amp a_1 \amp \cdots \amp a_{n-1}
\end{array}
\right)
+
\left( \begin{array}{c | c | c | c}
\psi_0 \amp \psi_1 \amp \cdots \amp \psi_{n-1}
\end{array} \right)
\\
~~~=
\left( \begin{array}{c|c|c|c}
x^T a_0 + \psi_0 \amp x^T a_1 + \psi_1 \amp \cdots \amp x^T
a_{n-1} + \psi_{n-1}
\end{array}
\right) .
\end{array}
\end{equation*}
This can be implemented as a loop:
\begin{equation*}
\begin{array}{l}
{\bf for~} j := 0, \ldots , n-1 \\[0.15in]
~~~
\left. \begin{array}{l}
{\bf for~} i := 0, \ldots , m-1 \\[0.15in]
~~~ \psi_{j} := \chi_{i} \alpha_{i,j} + \psi_{j} \\
{\bf end}
\end{array} \right\} ~~~ \begin{array}[t]{c}
\underbrace{\psi_j := x^T a_j + \psi_j}\\
\mbox{dot}
\end{array}
\\[0.2in]
{\bf end}
\end{array}
\end{equation*}
Alternatively, if we partition \(A \) by rows and \(x^T \) by elements, we get
\begin{equation*}
\begin{array}{l}
y^T :=
\left( \begin{array}{c | c | c | c}
\chi_0 \amp \chi_1 \amp \cdots \amp \chi_{m-1}
\end{array} \right)
\left( \begin{array}{c}
\widetilde a_{0}^T \\ \hline
\widetilde a_{1}^T \\ \hline
\vdots \\ \hline
\widetilde a_{m-1}^T
\end{array}
\right)
+
y^T \\
~~~=
\chi_0 \widetilde a_0^T +
\chi_1 \widetilde a_1^T +
\cdots +
\chi_{m-1} \widetilde a_{m-1}^T
+ y^T.
\end{array}
\end{equation*}
This can be implemented as a loop:
\begin{equation*}
\begin{array}{l}
{\bf for~} i := 0, \ldots , m-1 \\[0.15in]
~~~
\left. \begin{array}{l}
{\bf for~} j := 0, \ldots , n-1 \\[0.15in]
~~~ \psi_{j} := \chi_{i} \alpha_{i,j} + \psi_{j} \\
{\bf end}
\end{array} \right\} ~~~ \begin{array}[t]{c}
\underbrace{y^T := \chi_i \widetilde a_i^T + y^T}\\
\mbox{axpy}
\end{array}
\\[0.2in]
{\bf end}
\end{array}
\end{equation*}
There is an alternative way of looking at this operation:
\begin{equation*}
y^T := x^T A + y^T
\end{equation*}
is equivalent to
\begin{equation*}
(y^T)^T := ( x^T A )^T + (y^T)^T
\end{equation*}
and hence
\begin{equation*}
y := A^T x + y.
\end{equation*}
Thus, this operation is equivalent to matrix-vector multiplication with the transpose of the matrix.
Remark 1.4.1.
Since this operation does not play a role in our further discussions, we do not include exercises related to it.