Matrix-Vector Operations
Here I'll discuss a variety of Matrix-vector operations, naturally starting with matrix-vector multiplication.
function jgemvavx!(๐ฒ, ๐, ๐ฑ)
@turbo for i โ eachindex(๐ฒ)
๐ฒi = zero(eltype(๐ฒ))
for j โ eachindex(๐ฑ)
๐ฒi += ๐[i,j] * ๐ฑ[j]
end
๐ฒ[i] = ๐ฒi
end
end
Using a square Size
x Size
matrix ๐
, we find the following results.
If ๐
is transposed, or equivalently, if we're instead computing x * ๐
:
Finally, the three-argument dot product y' * ๐ * x
:
The performance impact of alignment is dramatic here.