BendTensors.MatT.sum: def of bend-tensors@0.0.0.2 Import: import bend-tensors@0.0.0.2/bend_tensors.bend as BendTensors Lines 923-940 of bend-tensors@0.0.0.2/bend_tensors.bend: https://jend.leeeet.dev/read.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&start_line=923&end_line=940 import Base # the sum of every cell def MatT.sum(+r: Nat, +c: Nat, m: MatT(r, c)) -> F32: match r c: case 0n 0n: MatB{b} = m Blk.sum(b) case 1n+p 0n: MatR{t, b} = m x y = MatT.sum(p, 0n, t) MatT.sum(p, 0n, b) (x + y : F32) case 0n 1n+q: MatC{l, r2} = m x y = MatT.sum(0n, q, l) MatT.sum(0n, q, r2) (x + y : F32) case 1n+p 1n+q: MatQ{a, b, c2, d} = m w x y z = MatT.sum(p, q, a) MatT.sum(p, q, b) MatT.sum(p, q, c2) MatT.sum(p, q, d) ((w + x) + (y + z) : F32) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=Blk.sum https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=MatT https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=MatT.Cols https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=MatT.Leaf https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=MatT.Quad https://jend.leeeet.dev/definition.txt?path=bend-tensors@0.0.0.2/bend_tensors.bend&name=MatT.Rows