pub fn apply<T>(&self, vec: &mut [T]) {
        for cycle in self.cycles.iter() {
            for pair in cycle.windows(2) {
                vec.swap(pair[0], pair[1]);
            }
        }
    }
/// Use the cycle decomposition to apply the corresponding on a mutable slice.
///
/// The permutation is appliedin-place using no more than `vec.len()` swaps.
/// Equivalent to `Permutation::apply`.
///
/// # 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(&mut vec);
/// assert_eq!(vec, ["cow", "bird", "dog", "pig", "cat", "sheep"]);
/// ```
Use the cycle decomposition to apply the corresponding on a mutable slice.
The permutation is appliedin-place using no more than `vec.len()` swaps.
Equivalent to `Permutation::apply`.
Use the cycle decomposition to apply the corresponding on a mutable slice . The permutation is appliedin - place using no more than ` vec . len () ` swaps . Equivalent to ` Permutation :: apply ` .
pub fn apply<T>(&self, vec: &mut [T]) {
        for cycle in self.cycles.iter() {
            for pair in cycle.windows(2) {
                vec.swap(pair[0], pair[1]);
            }
        }
    }
pub fn apply < T > ( & self , vec : & mut [ T ] ) { for cycle in self . cycles . iter ( ) { for pair in cycle . windows ( 2 ) { vec . swap ( pair [ 0 ] , pair [ 1 ] ) ; } } }
Use the cycle decomposition to apply the corresponding on a mutable slice.
Use the cycle decomposition to apply the corresponding on a mutable slice .
&self
vec
&mut [T]
&self
vec
&mut [T]
examples
None
use permutation::{permutation, cycles};
None