def exact_product

bendtorch-core@0.1.0.0 · src/tensor/signed.bend:92

import bendtorch-core@0.1.0.0/src/tensor/signed.bend as Signed
import Base

92# The product of the exact sizes, in Nat: what the laws state the inference
93# against. The inference never forms it, since it can pass the native Nat
94# limit of 2^48 on an empty input: [-1, 2^24, 2^24] multiplies to 2^48.
95def exact_product(extents: List<&2, Extent>) -> Nat:
96  match extents:
97    case Nil{}:
98      1n
99    case Exact{+size} <> tail:
100      Nat.mul(U32.to_nat(size), exact_product(tail))
101    case Inferred{} <> tail:
102      exact_product(tail)

Uses (5)

Used by (10)