def horner
import bendtorch-core@0.1.0.0/src/shape/core.bend as Coreimport Base
402def horner(dims: List<&2, U32>, values: List<&2, U32>, acc: Nat) -> Nat:
403 match dims values:
404 case head <> tail value <> rest:
405 horner(tail, rest, Nat.add(Nat.mul(acc, U32.to_nat(head)), U32.to_nat(value)))
406 case dims values:
407 acc
Uses (6)
Used by (8)
- bendtorch-core@0.1.0.0/src/tensor/layout:flatten_words
- bendtorch-core@0.1.0.0/src/shape/coordinate_proofs:horner_spec
- bendtorch-core@0.1.0.0/src/shape/core:flatten_checked.fits
- bendtorch-core@0.1.0.0/src/shape/boundary_proofs:horner_fits
- bendtorch-core@0.1.0.0/src/tensor/permutation_mapping:codec_flattened
- …