Sprawl is a lightweight, optimized Odin library for dealing with n-dimensional slices without indirection.
To read up on the base library, please read Structless.
To read up on the library using Sprawl_Slice
(an abstraction), please read Sprawl_Slice. Note this abstracts everything in Structless and essentially replaces it.
- Tetralux (optimization)
- sci4me (optimization)
The variables and parameters are as follows:
| l
- lengths
| i
- indexes
| n
- length of lengths
and indexes
(they are the same)
| j
- iterator
| k
- iterator
The formulae are 0-based. The upper values on the summation and multiplication are inclusive, hence why they are one lower than how they appear in the code. The formulae for this library are as follows.
LaTeX: g(l, i) = i_1 \cdot l_0 + i_0
LaTeX: h(l, n, i, j) = i_{n - j - 1} \cdot \prod_{k = 0}^{n - j - 2} l_k
f (_index)
LaTeX: f(l, n, i) = \sum_{j = 0}^{n - 3} (h(l_j, i, j)) + g(l, i)
LaTeX: f(l, n, i) = \sum_{j = 0}^{n - 3} \left(i_{n - j - 1} \cdot \prod_{k = 0}^{n - j - 2} l_k\right) + i_1 \cdot l_0 + i_0