3 ms·
Your reasoning starts out nicely with y=Ax, but you get the wrong conclusion. The layout of x and y are not affected at all by row or column order, they are jus
by planede 2y ago
Your reasoning starts out nicely with y=Ax, but you get the wrong conclusion. The layout of x and y are not affected at all by row or column order, they are just consecutive numbers in either case. So you have to look at the layout of A.
For the row-major layout the multiplication Ax ends up being more cache-efficient than for the column major layout, as for calculating each component of y you need to scan x and a row of A.
- bee_rider 2y agoI’m pretty sure BLAS will tile out the matrix multiplication internally anyway, so it doesn’t matter. At least for matmat would, is matvec special?
- planede 2y agoHowever matmat is done, row-major vs column-major for both matrices shouldn't make a difference (for square matrices at least). I don't know if tiling is done for matvec. I don't think it makes sense there, but I didn't think about it too hard.