def sdot

bendtorch@1.3.0.0 · main.bend:1309

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

1309# a[ia]·b[ib] + a[ia + sa]·b[ib + sb] + ... (k terms) added to acc left to right; ra and rb hold the
1310# first pair, already read
1311def sdot(k: Nat, +ia: U32, +ib: U32, +sa: U32, +sb: U32, acc: F32, ra: Array<F32> & F32, rb: Array<F32> & F32) -> D2:
1312  match k ra rb:
1313    case 0n Tuple{a, x} Tuple{b, y}:
1314      D2{a, b, acc}
1315    case 1n+p Tuple{a, +x} Tuple{b, +y}:
1316      sdot(p, (ia + sa : U32), (ib + sb : U32), sa, sb, (acc + (x * y : F32) : F32), Array.get(F32, a, (ia + sa : U32)), Array.get(F32, b, (ib + sb : U32)))

Uses (11)

Used by (1)