This operation ranges from (including) begin to (excluding) end using step as stride. In addition, this loop manages n loop accumulators whose initial values init must be given. On each iteration, the given body is invoked and receives
After termination of the loop, exit is invoked with the final accumulator values.
The affine index type is an opaque type that can only be manipulated through the following operations.
Constructs an affine index from a constant natural number.
Performs addition and subtraction on affine indices.
Negates an affine index.
Performs semi-linear operations on affine indices. The second argument is a natural number that must be constant with regard to the indices.
Performs multiplication of an affine index with a constant natural number. The second argument must be a closed constant - a stronger requirement than %affine.semiop imposes - which is enforced via %refly.check.
Maps a function over a list of affine indices. Any captured variables of the function must be closed over the entire list of indices, i.e. they must not depend on the iteration index. The moduli are per-element: each input index i carries its own modulus sin#i and each output index j its own sout#j.
The identity map on affine indices.
Row-major flattening of a multi-index: linearize(idxs, s) = Σ_k idxs#k · (∏_{j>k} s#j). s is the (row-major) shape; only its rank n need be a literal.
Row-major unflattening: delinearize(lin, s)#d = (lin floordiv (∏_{j>d} s#j)) mod s#d. The inverse of affine.linearize; only the rank m of s need be a literal.
Lowers the %%affine.For operation to recursive function calls.
Lowers the affine index algebra (%%affine.index, %%affine.constant, %%affine.op, %%affine.semiop, %%affine.map) to %core arithmetic.