Skip to content

Commit 3419e3c

Browse files
Merge pull request #32837 from goggle/dot-product-sparsevector-inbounds
Add inbounds macro to dot prodcut for sparse vectors
2 parents 5dd7636 + 6dad38e commit 3419e3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/SparseArrays/src/sparsevector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ function dot(x::AbstractVector{Tx}, y::SparseVectorUnion{Ty}) where {Tx<:Number,
14161416
nzind = nonzeroinds(y)
14171417
nzval = nonzeros(y)
14181418
s = dot(zero(Tx), zero(Ty))
1419-
for i = 1:length(nzind)
1419+
@inbounds for i = 1:length(nzind)
14201420
s += dot(x[nzind[i]], nzval[i])
14211421
end
14221422
return s

0 commit comments

Comments
 (0)