def MatT.matvec
bend-tensors@0.0.0.2 · bend_tensors.bend:901
import bend-tensors@0.0.0.2/bend_tensors.bend as BendTensors
import Base
901
902def MatT.matvec(+r: Nat, +c: Nat, +m: MatT(r, c), +v: VecT(c)) -> VecT(r):
903 match r c:
904 case 0n 0n:
905 MatB{b} = m
906 VecL{x} = v
907 VecL{Blk.matvec(b, x)}
908 case 1n+p 0n:
909 MatR{t, b} = m
910 x y = MatT.matvec(p, 0n, t, v) MatT.matvec(p, 0n, b, v)
911 VecN{x, y}
912 case 0n 1n+q:
913 MatC{l, r2} = m
914 VecN{vl, vr} = v
915 x y = MatT.matvec(0n, q, l, vl) MatT.matvec(0n, q, r2, vr)
916 VecT.add(0n, x, y)
917 case 1n+p 1n+q:
918 MatQ{a, b, c2, d} = m
919 VecN{vl, vr} = v
920 p0 q0 p1 q1 = MatT.matvec(p, q, a, vl) MatT.matvec(p, q, b, vr) MatT.matvec(p, q, c2, vl) MatT.matvec(p, q, d, vr)
921 VecT.add2(p, p0, q0, p1, q1)