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. Amulvb

If ๐€ is transposed, or equivalently, if we're instead computing x * ๐€: Atmulvb

Finally, the three-argument dot product y' * ๐€ * x: dot3

The performance impact of alignment is dramatic here.