pub fn apply_inv<T>(&self, vec: &mut [T]) {
        for cycle in self.cycles.iter().rev() {
            for pair in cycle.windows(2).rev() {
                vec.swap(pair[0], pair[1]);
            }
        }
    }
/// Use the cycle decomposition to apply the inverse permutation on a mutable slice.
/// This is equivalent to "undoing" the permutation.
///
/// The permutation is applied in-place using no more than `vec.len()` swaps.
/// Equivalent to `Permutation::apply_inv`.
///
/// # Examples
///
/// ```
/// # use permutation::{Permutation, Cycles};
/// let perm = Cycles::from(Permutation::from_vec(vec![1, 3, 0, 4, 2, 5]));
///
/// let mut vec = ["dog", "cow", "cat", "bird", "pig", "sheep"];
/// perm.apply_inv(&mut vec);
/// assert_eq!(vec,["cat", "dog", "pig", "cow", "bird", "sheep"]);
/// ```
Use the cycle decomposition to apply the inverse permutation on a mutable slice.
This is equivalent to "undoing" the permutation.

The permutation is applied in-place using no more than `vec.len()` swaps.
Use the cycle decomposition to apply the inverse permutation on a mutable slice . This is equivalent to " undoing " the permutation . The permutation is applied in - place using no more than ` vec . len () ` swaps .
pub fn apply_inv<T>(&self, vec: &mut [T]) {
        for cycle in self.cycles.iter().rev() {
            for pair in cycle.windows(2).rev() {
                vec.swap(pair[0], pair[1]);
            }
        }
    }
pub fn apply_inv < T > ( & self , vec : & mut [ T ] ) { for cycle in self . cycles . iter ( ) . rev ( ) { for pair in cycle . windows ( 2 ) . rev ( ) { vec . swap ( pair [ 0 ] , pair [ 1 ] ) ; } } }
Use the cycle decomposition to apply the inverse permutation on a mutable slice.
Use the cycle decomposition to apply the inverse permutation on a mutable slice .
&self
vec
&mut [T]
&self
vec
&mut [T]
examples
None
use permutation::{permutation, cycles};
None