Histogram.cols: def of bend-parallel@0.1.0.0 Import: import bend-parallel@0.1.0.0/histogram.bend as Histogram Lines 268-284 of bend-parallel@0.1.0.0/histogram.bend: https://jend.leeeet.dev/read.txt?path=bend-parallel@0.1.0.0/histogram.bend&start_line=268&end_line=284 import Base # Pass 2b's forks: d levels down to groups of 2^w columns under group index # j. ft and fc are two handles each to the table and the counts. Group j # reads only its columns of the table and writes only its counts (entries # j * 2^w to j * 2^w + 2^w - 1): no two lanes write one slot. def cols(+d: Nat, +j: U32, +w: Nat, +k: U32, +o: U32, +step: U32, +nb: Nat, ft: Array & Array, fc: Array & Array) -> Two: match d: case 0n: (t, t2) = ft (cs, cs2) = fc two.rejoin(t2, cs2, cols.go(U32.to_nat((U32.shln(1, w) - 1 : U32)), U32.shln(j, w), k, o, step, nb, Two{t, cs})) case 1n+p: (t0, t1) = ft (c0, c1) = fc +i = (j * 2 : U32) l r = cols(p, i, w, k, o, step, nb, Array.fork(U32, t0), Array.fork(U32, c0)) cols(p, (i + 1 : U32), w, k, o, step, nb, Array.fork(U32, t1), Array.fork(U32, c1)) two.join(l, r) Uses (15): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.fork https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shln https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=Two https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=cols.go https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=two.join https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=two.rejoin