def fwds

bend-parallel@0.1.0.0 · sort.bend:265

import bend-parallel@0.1.0.0/sort.bend as Sort
import Base
import bend-parallel@0.1.0.0/histogram.bend as Hist

265# The forks, shaped as pass 2b's, with two handles each to the table and
266# the offsets. Group j reads only its own offsets and reads and writes
267# only its columns of the table.
268def fwds(+d: Nat, +j: U32, +w: Nat, +k: U32, +kb: Nat, +nb: Nat, ft: Array<U32> & Array<U32>, fo: Array<U32> & Array<U32>) -> Hist.Two:
269  match d:
270    case 0n:
271      (t, t2) = ft
272      (os, os2) = fo
273      Hist.two.rejoin(t2, os2, fwd.cols(U32.to_nat((U32.shln(1, w) - 1 : U32)), U32.shln(j, w), k, kb, nb, Hist.Two{t, os}))
274    case 1n+p:
275      (t0, t1) = ft
276      (o0, o1) = fo
277      +i = (j * 2 : U32)
278      l r = fwds(p, i, w, k, kb, nb, Array.fork(U32, t0), Array.fork(U32, o0))
279        fwds(p, (i + 1 : U32), w, k, kb, nb, Array.fork(U32, t1), Array.fork(U32, o1))
280      Hist.two.join(l, r)

Uses (15)

Used by (1)