pub struct FinExtPerm {
pub perm: Vec<usize>,
}Expand description
A permutation of {0, ..., n-1} stored as a vector.
Fields§
§perm: Vec<usize>The permutation as a map: index i → perm[i].
Implementations§
Source§impl FinExtPerm
impl FinExtPerm
Sourcepub fn from_vec(v: Vec<usize>) -> Option<Self>
pub fn from_vec(v: Vec<usize>) -> Option<Self>
Create a permutation from a vector. Returns None if not a valid permutation.
Sourcepub fn compose(&self, other: &Self) -> Option<Self>
pub fn compose(&self, other: &Self) -> Option<Self>
Compose self ∘ other (apply other first, then self).
Sourcepub fn sign(&self) -> i32
pub fn sign(&self) -> i32
Compute the sign (parity) of the permutation: +1 for even, -1 for odd.
Sourcepub fn cycle_count(&self) -> usize
pub fn cycle_count(&self) -> usize
Count the number of cycles.
Sourcepub fn is_derangement(&self) -> bool
pub fn is_derangement(&self) -> bool
Check if this permutation is a derangement (no fixed points).
Trait Implementations§
Source§impl Clone for FinExtPerm
impl Clone for FinExtPerm
Source§fn clone(&self) -> FinExtPerm
fn clone(&self) -> FinExtPerm
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 FinExtPerm
impl Debug for FinExtPerm
Source§impl PartialEq for FinExtPerm
impl PartialEq for FinExtPerm
impl Eq for FinExtPerm
impl StructuralPartialEq for FinExtPerm
Auto Trait Implementations§
impl Freeze for FinExtPerm
impl RefUnwindSafe for FinExtPerm
impl Send for FinExtPerm
impl Sync for FinExtPerm
impl Unpin for FinExtPerm
impl UnsafeUnpin for FinExtPerm
impl UnwindSafe for FinExtPerm
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