pub fn new(forward: Vec<usize>) -> Self {
        let mut backward = forward.iter()
            .enumerate()
            .map(|(i, j)| (*j, i))
            .collect::<Vec<_>>();
        backward.sort_unstable_by_key(|&(j, _)| j);
        let backward = backward.into_iter().map(|(_, i)| i).collect();

        Self {
            forward,
            backward,
        }
    }
/// Create a new instance.
///
/// Computes the inverse by sorting.
Create a new instance.
Computes the inverse by sorting.
Create a new instance . Computes the inverse by sorting .
pub fn new(forward: Vec<usize>) -> Self {
        let mut backward = forward.iter()
            .enumerate()
            .map(|(i, j)| (*j, i))
            .collect::<Vec<_>>();
        backward.sort_unstable_by_key(|&(j, _)| j);
        let backward = backward.into_iter().map(|(_, i)| i).collect();
        Self {
            forward,
            backward,
        }
    }
pub fn new ( forward : Vec < usize > ) -> Self { let mut backward = forward . iter ( ) . enumerate ( ) . map ( | ( i , j ) | ( * j , i ) ) . collect :: < Vec < _ > > ( ) ; backward . sort_unstable_by_key ( | & ( j , _ ) | j ) ; let backward = backward . into_iter ( ) . map ( | ( _ , i ) | i ) . collect ( ) ; Self { forward , backward , } }
Create a new instance.
Create a new instance .
forward
Vec<usize>
forward
Vec<usize>