def flatten
import bendtorch-core@0.1.0.0/src/shape/core.bend as Coreimport Base
147def flatten(+dims: List<&2, Nat>, coordinate: Coordinate(dims)) -> Fin(numel(dims)):
148 match dims:
149 case Nil{}:
150 FZero{}
151 case +head <> +tail:
152 CStep{index, rest} = coordinate
153 Fin.pack(head, numel(tail), (index, flatten(tail, rest)))
Uses (9)
Used by (11)
- bendtorch-core@0.1.0.0/src/shape/index_proofs:flatten_row_major
- bendtorch-core@0.1.0.0/src/shape/coordinate_proofs:row_major_lt
- bendtorch-core@0.1.0.0/src/shape/index_proofs:flatten_unflatten
- bendtorch-core@0.1.0.0/src/shape/index_proofs:unflatten_flatten
- bendtorch-core@0.1.0.0/src/shape/index_proofs:flatten_unflatten_step
- …