def ewi_loop

bendtorch-gpu@1.3.0.0 · main.bend:90

import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpu
import Base

90# o[i] = f(o[i], y[i]) for the leaf's cells, in place (o's old value is the first argument)
91def ewi_loop(~f: @+a: F32 -> @+b: F32 -> F32, k: Nat, +i: U32, +l: U32, ro: Array<F32> & F32, ry: Array<F32> & F32) -> Array<F32>:
92  match k ro ry:
93    case 0n Tuple{o, +x} Tuple{y, +v}: o
94    case 1n+q Tuple{o, +x} Tuple{y, +v}: ewi_loop(~f, q, (i + l : U32), l, Array.get(F32, Array.set(F32, o, i, f(x, v)), (i + l : U32)), Array.get(F32, y, (i + l : U32)))

Uses (9)

Used by (1)