def MatT.scale

bend-tensors@0.0.0.2 · bend_tensors.bend:778

import bend-tensors@0.0.0.2/bend_tensors.bend as BendTensors
import Base

778def MatT.scale(+r: Nat, +c: Nat, +k: F32, m: MatT(r, c)) -> MatT(r, c):
779  match r c:
780    case 0n 0n:
781      MatB{b} = m
782      MatB{Blk.scale(k, b)}
783    case 1n+p 0n:
784      MatR{t, b} = m
785      x y = MatT.scale(p, 0n, k, t) MatT.scale(p, 0n, k, b)
786      MatR{x, y}
787    case 0n 1n+q:
788      MatC{l, r2} = m
789      x y = MatT.scale(0n, q, k, l) MatT.scale(0n, q, k, r2)
790      MatC{x, y}
791    case 1n+p 1n+q:
792      MatQ{a, b, c2, d} = m
793      w x y z = MatT.scale(p, q, k, a) MatT.scale(p, q, k, b) MatT.scale(p, q, k, c2) MatT.scale(p, q, k, d)
794      MatQ{w, x, y, z}

Uses (8)

Used by (1)