Closed
Description
This just came up on discourse:
julia> a1 = rand(9, 9)
9×9 Array{Float64,2}:
julia> a2 = rand(9, 9)
9×9 Array{Float64,2}:
julia> s1 = SArray{Tuple{9,9}}(a1)
9×9 SArray{Tuple{9,9},Float64,2,81}:
julia> s2 = SArray{Tuple{9,9}}(a2)
9×9 SArray{Tuple{9,9},Float64,2,81}:
julia> @btime dot($a1, $a2)
22.762 ns (0 allocations: 0 bytes)
18.782035065611815
julia> @btime dot($s1, $s2)
70.213 ns (0 allocations: 0 bytes)
18.782035065611826
julia> @btime dot($(vec(a1)), $(vec(a2)))
23.527 ns (0 allocations: 0 bytes)
18.782035065611815
julia> @btime dot($(vec(s1)), $(vec(s2)))
15.570 ns (0 allocations: 0 bytes)
18.782035065611815
Is there any reason that dot
is special-cased for multi-dimensional SArray
s and not just implemented as dot(vec(s1), vec(s2))
?
Metadata
Metadata
Assignees
Labels
No labels