Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/FsMath/SpanMath.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type SpanMath =
let vy = Numerics.Vector<'T>(y.Slice(yi, simdWidth))
accVec <- accVec + (vx * vy)

let mutable acc = LanguagePrimitives.GenericZero<'T>
for i = 0 to simdWidth - 1 do
acc <- acc + accVec.[i]
// Use Vector.Sum for optimized horizontal reduction (uses hardware-specific instructions)
let mutable acc = Numerics.Vector.Sum(accVec)

// Handle remaining elements (tail)
for i = ceiling to length - 1 do
acc <- acc + x.[xOffset + i] * y.[yOffset + i]

Expand Down
Loading