pub struct Permutation {
pub perm: Vec<usize>,
}Expand description
A permutation of indices 0..n.
Fields§
§perm: Vec<usize>Implementations§
Source§impl Permutation
impl Permutation
Sourcepub fn from_sort_order<T: Ord>(v: &[T]) -> Self
pub fn from_sort_order<T: Ord>(v: &[T]) -> Self
Create a permutation from a sorted-order vector.
perm[i] = j means that position i in the sorted order
came from position j in the original.
Sourcepub fn apply<T: Clone>(&self, v: &[T]) -> Vec<T>
pub fn apply<T: Clone>(&self, v: &[T]) -> Vec<T>
Apply the permutation to a slice, returning a new Vec.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Check if this is the identity permutation.
Trait Implementations§
Source§impl Clone for Permutation
impl Clone for Permutation
Source§fn clone(&self) -> Permutation
fn clone(&self) -> Permutation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Permutation
impl Debug for Permutation
Source§impl PartialEq for Permutation
impl PartialEq for Permutation
impl Eq for Permutation
impl StructuralPartialEq for Permutation
Auto Trait Implementations§
impl Freeze for Permutation
impl RefUnwindSafe for Permutation
impl Send for Permutation
impl Sync for Permutation
impl Unpin for Permutation
impl UnsafeUnpin for Permutation
impl UnwindSafe for Permutation
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