The notation \(x^T y \) comes from the fact that the dot product also equals the result of multiplying \(1 \times n\) matrix \(x^T \) times \(n \times 1 \) matrix \(y \text{.}\)
The point we are trying to make here is that \(\gamma_{2,1} \) is computed as the dot product of the third row of \(A \) (the row indexed with \(2 \)) with the last column of \(B \) (the column indexed with \(1 \)):
Importantly, if you think back about how matrices are stored in column-major order, marching through memory from one element to the next element in the last row of \(A
\text{,}\) as you access \(\widetilde a_2^T \text{,}\) requires "striding" through memory.
A routine, coded in C, that computes \(x^T y + \gamma \) where \(x \) and \(y \) are stored at location x with stride incx and location y with stride incy, respectively, and \(\gamma \) is stored at location gamma, is given by
#define chi( i ) x[ (i)*incx ] // map chi( i ) to array x
#define psi( i ) y[ (i)*incy ] // map psi( i ) to array y
void Dots( int n, double *x, int incx, double *y, int incy, double *gamma )
{
for ( int i=0; i<n; i++ )
*gamma += chi( i ) * psi( i );
}
in Assignments/Week1/C/Dots.c. Here stride refers to the number of items in memory between the stored components of the vector. In particular, the stride when accessing a row of a matrix is ldA when the matrix is stored in column-major order with leading dimension ldA, as illustrated in Figure 1.2.2.
Homework1.3.2.2.
Consider the following double precision values stored in sequential memory starting at address A