OriginalIndex
OriginalIndex is a data concept used to record the original positions of elements before a transformation such as sorting, filtering, or grouping. It serves as a permutation vector that allows a program to map results back to the source order or to trace how the transformed data relates to its input.
Construction and interpretation are straightforward. To create an OriginalIndex, pair each element with its original index,
A simple example: given values [50, 20, 30], sorting ascending yields [20, 30, 50], and the OriginalIndex
Variants and properties include treating the OriginalIndex as a permutation vector of length n, with memory