def grp

bend-parallel@0.1.0.0 · histogram.bend:230

import bend-parallel@0.1.0.0/histogram.bend as Histogram
import Base

230# Pass 2a's forks (sort.bend's too, with sc): d levels down to the lanes
231# under lane i, with two handles to the table. Lane i reads and writes
232# only its group's rows in its columns: no two lanes touch one slot.
233def grp(+d: Nat, +sc: Bool, +i: U32, +gc: Nat, +w: Nat, +m: Nat, +kb: Nat, +k: U32, ft: Array<U32> & Array<U32>) -> Array<U32>:
234  match d:
235    case 0n:
236      (t, t2) = ft
237      Array.join(U32, grp.leaf(sc, i, gc, w, m, kb, k, t), t2)
238    case 1n+p:
239      (t0, t1) = ft
240      +j = (i * 2 : U32)
241      l r = grp(p, sc, j, gc, w, m, kb, k, Array.fork(U32, t0))
242        grp(p, sc, (j + 1 : U32), gc, w, m, kb, k, Array.fork(U32, t1))
243      Array.join(U32, l, r)

Uses (11)

Used by (2)