We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 609313c + 5089504 commit acf5db8Copy full SHA for acf5db8
src/FsMath/SpanMath.fs
@@ -36,10 +36,10 @@ type SpanMath =
36
let vy = Numerics.Vector<'T>(y.Slice(yi, simdWidth))
37
accVec <- accVec + (vx * vy)
38
39
- let mutable acc = LanguagePrimitives.GenericZero<'T>
40
- for i = 0 to simdWidth - 1 do
41
- acc <- acc + accVec.[i]
+ // Use Vector.Sum for optimized horizontal reduction (uses hardware-specific instructions)
+ let mutable acc = Numerics.Vector.Sum(accVec)
42
+ // Handle remaining elements (tail)
43
for i = ceiling to length - 1 do
44
acc <- acc + x.[xOffset + i] * y.[yOffset + i]
45
0 commit comments