def last_of_run

stelliferous@0.0.2.0 · tensor_access.bend:8

import stelliferous@0.0.2.0/tensor_access.bend as TensorAccess
import Base
import stelliferous@0.0.2.0/traversal_array.bend as Traversal
import stelliferous@0.0.2.0/tensor_cursor.bend as Cursor

8# A strided operation visits the source view in row-major order. It proceeds
9# in runs of the innermost axis: every element of a run but the last advances
10# only the address, and the last takes the ordinary cursor step, which carries
11# into the outer axes. The element loop is a small native loop whatever else
12# shares the cursor; stepping the whole cursor per element costs several calls
13# with a wide state once more than one operation uses it. inside and last are
14# the same element action, stepping a stride and the whole cursor.
15def last_of_run(~Element: Data,extent: Nat,stride: U32,rewind: U32,rest: Cursor.Depth1(),
16  state: Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Stride>) -> Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Cursor>:
17  Traversal.State{input,output,position,Cursor.Stride{address,step}} = state
18  Traversal.State{input,output,position,Cursor.Cursor{Cursor.Level{Cursor.Axis{extent,1n,stride,rewind},rest},address}}

Uses (9)

Used by (3)