def ew2_l

bendtorch@1.3.0.0 · main.bend:174

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base
import bend-ml-tensor-array@0.1.18.0/main.bend as TA

174# a[t] = f(a[t], b[t]): the result replaces a; b comes back unchanged
175def ew2_l(~f: @+a: F32 -> @+b: F32 -> F32, nleft: Nat, +t: U32, ra: Array<F32> & F32, rb: Array<F32> & F32) -> TA.P2:
176  match nleft ra rb:
177    case 0n Tuple{a, v} Tuple{b, w}:
178      TA.P2{a, b}
179    case 1n+p Tuple{a, +v} Tuple{b, +w}:
180      ew2_l(~f, p, (t + 1 : U32), Array.get(F32, Array.set(F32, a, t, f(v, w)), (t + 1 : U32)), Array.get(F32, b, (t + 1 : U32)))

Uses (10)

Used by (2)