Unit 1.2.3 A convention regarding the letters used for the loop index
ΒΆWhen we talk about loops for matrix-matrix multiplication, it helps to keep in mind the picture
which illustrates which loop index (variable name) is used for what row or column of the matrices.Index \(i \) is used to index the row of \(C \) and corresponding row of \(A \text{.}\)
Index \(j \) is used to index the column of \(C \) and corresponding column of \(B \text{.}\)
Index \(p \) is used to index the column of \(A \) and corresponding row of \(B \text{.}\)
We try to be consistent in this use, as should you.
Remark 1.2.4.
In the literature, people often use \(i\text{,}\) \(j\text{,}\) and \(k\) for indexing the three loops and talk about the \(ijk\) loop ordering when we talk about the IJP ordering (later in Week 1). The problem with that convention is that \(k\) is also used for the "inner size" of the matrices (the column size of \(A \) and the row size of \(B \)). It is for this reason that we use \(p\) instead.
Our convention comes with its own problems, since \(p\) is often used to indicate the number of processors involved in a computation. No convention is perfect!