BendMlTensorFork.blocks3: def of bend-ml-tensor-fork@0.1.6.0
Import: import bend-ml-tensor-fork@0.1.6.0/main.bend as BendMlTensorFork
Lines 73-81 of bend-ml-tensor-fork@0.1.6.0/main.bend: https://jend.leeeet.dev/read.txt?path=bend-ml-tensor-fork@0.1.6.0/main.bend&start_line=73&end_line=81
import Base
def blocks3(~E: Data, ~A: Type, ~B: Type, ~C: Type, ~f: @+e: E -> @+i0: U32 -> @+cnt: Nat -> B3 -> B3, +e: E, d: Nat, +i0: U32, +cnt: Nat, pa: Array & Array, pb: Array & Array, pc: Array & Array) -> B3:
match d pa pb pc:
case 0n Tuple{a, a2} Tuple{b, b2} Tuple{c, c2}:
f(e, i0, cnt, B3{a, b, c})
case 1n++q Tuple{a, a2} Tuple{b, b2} Tuple{c, c2}:
l r = blocks3(~E, ~A, ~B, ~C, ~f, e, q, i0, Nat.div(cnt, 2n), Array.fork(A, a), Array.fork(B, b), Array.fork(C, c)) blocks3(~E, ~A, ~B, ~C, ~f, e, q, (i0 + U32.from_nat(Nat.div(cnt, 2n)) : U32), Nat.sub(cnt, Nat.div(cnt, 2n)), Array.fork(A, a2), Array.fork(B, b2), Array.fork(C, c2))
join3(A, B, C, l, r)
@unsafe
Uses (12):
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=Nat.div
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub
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.from_nat
https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-fork@0.1.6.0/main.bend&name=B3
https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor-fork@0.1.6.0/main.bend&name=join3