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>(
dest: &[I],
num_runs: usize,
) -> Result<RunIndex, StridedError>where
I: GatherIndex,
pub fn from_dest<I>(
dest: &[I],
num_runs: usize,
) -> Result<RunIndex, StridedError>where
I: GatherIndex,
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<RunIndex, StridedError>
pub fn from_ptr(ptr: Vec<usize>) -> Result<RunIndex, StridedError>
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RunIndex
impl RefUnwindSafe for RunIndex
impl Send for RunIndex
impl Sync for RunIndex
impl Unpin for RunIndex
impl UnsafeUnpin for RunIndex
impl UnwindSafe for RunIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more