Given 2 matrices: $X(rows=m,cols=n)$ and $Y(rows=m,cols=1)$, which of the following operations is computationally easy, i.e., easy on the machine?
$$X^{T} \times Y \\ or \\ (Y^{T} \times X)^{T} $$
Given 2 matrices: $X(rows=m,cols=n)$ and $Y(rows=m,cols=1)$, which of the following operations is computationally easy, i.e., easy on the machine?
$$X^{T} \times Y \\ or \\ (Y^{T} \times X)^{T} $$
Copyright © 2021 JogjaFile Inc.
The operational count (number of multiplications and additions) is the same for each approach.
If your software uses column-major order (e.g. Fortran, Matlab, R), then the computation of $Y^TX$ will be easier - but the transposition in memory to get $(Y^TX)^T$ from $Y^TX$ may be expensive.
If you are using row-major order (C/C++/C#, Mathematica, Python), the first approach will be easier and not require an additional transposition.