pub struct RunIndex { /* private fields */ }Expand description
Rows grouped by destination: CSR offsets plus a stable row permutation.
ptr holds runs + 1 offsets and perm is either the identity (rows are
already grouped, so the plan walks 0..rows) or as long as the row count.
Implementations§
Source§impl RunIndex
impl RunIndex
Sourcepub fn from_dest<I: GatherIndex>(dest: &[I], num_runs: usize) -> Result<Self>
pub fn from_dest<I: GatherIndex>(dest: &[I], num_runs: usize) -> Result<Self>
Group an unsorted destination list with a stable counting sort.
Row e joins run dest[e], and rows keep their original order inside a
run. A destination that is already non-decreasing keeps the identity
permutation and only pays for the offsets. Allocates; call it when the
topology changes, never per execution.
§Errors
Returns StridedError::IndexOutOfRange when an index is negative, is
not below num_runs, or is present while num_runs is zero, and
StridedError::OffsetOverflow when the row count does not fit usize.
Sourcepub fn from_ptr(ptr: Vec<usize>) -> Result<Self>
pub fn from_ptr(ptr: Vec<usize>) -> Result<Self>
Take rows a caller has already grouped.
ptr is the CSR offset list: runs + 1 non-decreasing entries starting
at zero, so ptr[r]..ptr[r + 1] is the row range of run r and
ptr[last] is the row count. Holds the Vec as given and allocates
nothing.
§Errors
Returns StridedError::InvalidRunIndex when ptr is empty, does not
start at zero, or steps downwards.