No, I think it’s the other way around. Outer product does GEMM in a single instruction.
How would that work? Outer product is the result of pairwise multiplication of elements over two vectors, i.e.
z[i,j] = x[i]*y[j]
. Matrix multiplication instead requires you to compute dot products over rows and columns, i.e. z[i,y] = x[i,] · y[,j]
. There is obviously some duality between the two operations, but given that my mathematics days are long over, this is as much as I dare say Anyway, for GEMM you need to perform an outer product + accumulate for each row and column with matching index.P.S. Wikipedia contains more detailed formulas and discussion: https://en.wikipedia.org/wiki/Outer_product
P.P.S. My intuition tells me that outer products can be more useful if you know that your matrices have some special constraints or need to perform some other operations. Unfortunately, much of the mainstream linalg education is focused on dot and matrix products, and I suppose that not many people are trained to think about these things in terms of outer products. Then again, linear algebra is a historical misunderstanding and a corner case of the much more general geometric algebra, so maybe we should all relearn
Last edited: