Struct multivariate_optimization::splitter::Splitter
source · pub struct Splitter { /* private fields */ }Expand description
Memorizes random assignment of indices to groups.
Implementations§
source§impl Splitter
impl Splitter
sourcepub fn new<R: Rng + ?Sized>(
rng: &mut R,
source_len: usize,
group_count: usize
) -> Self
pub fn new<R: Rng + ?Sized>( rng: &mut R, source_len: usize, group_count: usize ) -> Self
Randomly assign indices to fixed number of groups.
Create a Splitter struct, by randomly assigning indices (from
0..source_len) to a fixed number of groups (group_count).
The returned struct provides access to the created groups (containing
their assigned indices, see groups) and allows merging of iterators
(see merge).
If group_count is smaller than source_len, the number of groups is
set (i.e. limited) to input_len.
sourcepub fn assignments(&self) -> &[usize]
pub fn assignments(&self) -> &[usize]
Return slice containing index of assigned group for each original index.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Splitter
impl Send for Splitter
impl Sync for Splitter
impl Unpin for Splitter
impl UnwindSafe for Splitter
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
Mutably borrows from an owned value. Read more