BatchedMatmulLAWS.matrix_offset: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend as BatchedMatmulLAWS Lines 182-190 of bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/batched_matmul_LAWS.bend&start_line=182&end_line=190 import Base import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix # Term k of row (or column) `outer` of a matrix of `outers` rows (or # columns) and `inner` terms: `[outers, inner]` read by rows (Kept), or # `[inner, outers]` read by columns (Swapped). def matrix_offset(+order: Matrix.Order, +inner: Nat, +outers: Nat, +outer: Nat, +k: Nat) -> Nat: match order: case Matrix.Kept{}: Nat.add(Nat.mul(outer, inner), k) case Matrix.Swapped{}: Nat.add(Nat.mul(k, outers), outer) Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/matmul.bend&name=Order