def array_sum
import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reductionimport Base
82# The first `fuel` words of the array from slot `cursor`, added to
83# `accumulator` left to right: the F32 adds of `natural_sum_loop`, in the
84# same order.
85def array_sum(fuel: Nat, +cursor: Nat, accumulator: F32, array: Array<F32>) -> F32 & Array<F32>:
86 match fuel:
87 case 0n:
88 (accumulator, array)
89 case 1n+rest:
90 array_run(rest, cursor, accumulator, Array.get(F32, array, U32.from_nat(cursor)))
Uses (8)
Used by (7)
- bendtorch-core@0.1.0.0/src/tensor/reduction:tensor_sum
- bendtorch-core@0.1.0.0/src/tensor/reduction:array_sum_keeps
- bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF:tensor_value
- bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF:fold_value
- bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF:owned_value
- …