def cell_dot

bendtorch-core@0.1.0.0 · src/tensor/matmul.bend:264

import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matmul
import Base

264# The terms k = cursor .. cursor + fuel - 1 of cell (row, column), added to
265# `accumulator`. Both arrays come back with the total: the run from term
266# cursor, where term k + 1 sits one word on in the left row and `columns`
267# words on in the right column.
268def cell_dot(fuel: Nat, +inner: Nat, +columns: Nat, +row: Nat, +column: Nat, +cursor: Nat, accumulator: F32,
269  la: Array<F32>, ra: Array<F32>) -> F32 & (Array<F32> & Array<F32>):
270  match fuel:
271    case 0n:
272      (accumulator, (la, ra))
273    case 1n+rest:
274      product_run(rest, 1n, columns, Nat.add(Nat.mul(row, inner), cursor), Nat.add(Nat.mul(cursor, columns), column), accumulator,
275        Array.get(F32, la, left_index(inner, row, cursor)), Array.get(F32, ra, right_index(columns, column, cursor)))

Uses (11)

Used by (3)