def frob

bendtorch@1.3.0.0 · spec.bend:60

import bendtorch@1.3.0.0/spec.bend as Spec
import Base

60# the sum of the products of matching entries of two matrices (Frobenius inner product)
61def frob(a: List<&2, List<&2, Nat>>, b: List<&2, List<&2, Nat>>) -> Nat:
62  match a b:
63    case Con{ar, at} Con{br, bt}:
64      Nat.add(dotn(ar, br), frob(at, bt))
65    case _ _:
66      0n

Uses (4)

Used by (1)