You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
3 argument dot is slower than a matmul and two arg dot #1287
using LinearAlgebra, StaticArrays, BenchmarkTools
f1(x, A) =dot(x, A * x)
f2(x, A) =dot(x, A, x)
let
x =randn(3)
A =randn(3, 3)
A = A * A'+1e-6* I
sx =SVector{3}(x...)
sA =SMatrix{3,3}(A...)
display(@benchmark(f1($sx, $sA)))
display(@benchmark(f2($sx, $sA)))
end
Activity
kbarros commentedon Oct 26, 2026
I hit this also. A simple fix would be the method overload:
Would this be welcomed as a PR?
kbarros commentedon Oct 29, 2026
Also, apparently
u' * A * vtranslates todot(u, A, v), so this is not an esoteric situation.