MCPcopy Create free account
hub / github.com/egonelbre/exp / Reduce2

Function Reduce2

vector/vector/def.go:74–88  ·  view source on GitHub ↗
(
	xs, ys Vector[T],
	n uintptr,
	zero T,
	fn func(r, x, y T) T,
)

Source from the content-addressed store, hash-verified

72}
73
74func Reduce2[T any](
75 xs, ys Vector[T],
76 n uintptr,
77 zero T,
78 fn func(r, x, y T) T,
79) (result T) {
80 result = zero
81 xi, yi := xs.Offset, ys.Offset
82 for i := uintptr(0); i < n; i++ {
83 result = fn(result, xs.Values[xi], ys.Values[xi])
84 xi += xs.Inc
85 yi += ys.Inc
86 }
87 return result
88}

Callers 1

DotFunction · 0.85

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected