2.2.12 Cells

The final part of an SPV light member contains the actual data.

Cells => int32[n-cells] Cell*[n-cells]
Cell => int64[index] v1(00?) Value

A Cell consists of an index and a Value. Suppose there are d dimensions, numbered 1 through d in the order given in the Dimensions previously, and that dimension i has n_i categories. Consider the cell at coordinates x_i, 1 \le i \le d, and note that 0 \le x_i < n_i. Then the index is calculated by the following algorithm:

let index = 0
for each i from 1 to d:
    index = (n_i \times index) + x_i

For example, suppose there are 3 dimensions with 3, 4, and 5 categories, respectively. The cell at coordinates (1, 2, 3) has index 5 \times (4 \times (3 \times 0 + 1) + 2) + 3 = 33. Within a given dimension, the index is the leaf-index in a Leaf.