fn permutation_groups_of_orbit_indexes(
    v_counts: &Vec<usize>
) -> Vec<Vec<usize>> {
    let mut results: Vec<Vec<usize>> = vec![];

    if v_counts.len() == 1 {
        results = (0..v_counts[0]).map(|idx| vec![idx]).collect();
    } else if v_counts.len() > 1{
        let mut v_counts_down = v_counts.clone();
        if let Some(count) = v_counts_down.pop() {
            let results_down: Vec<Vec<usize>> = permutation_groups_of_orbit_indexes(&v_counts_down);
            for i in 0..count {
                let mut results_down_tmp = results_down.clone();
                while let Some(mut result_tmp) = results_down_tmp.pop() {
                    result_tmp.push(i);
                    results.push(result_tmp);
                }
            }
        }
    }

    results
}
/// Auxiliary function for create combination of permutations from multiple vectors 
Auxiliary function for create combination of permutations from multiple vectors
Auxiliary function for create combination of permutations from multiple vectors
fn permutation_groups_of_orbit_indexes(
    v_counts: &Vec<usize>
) -> Vec<Vec<usize>> {
    let mut results: Vec<Vec<usize>> = vec![];
    if v_counts.len() == 1 {
        results = (0..v_counts[0]).map(|idx| vec![idx]).collect();
    } else if v_counts.len() > 1{
        let mut v_counts_down = v_counts.clone();
        if let Some(count) = v_counts_down.pop() {
            let results_down: Vec<Vec<usize>> = permutation_groups_of_orbit_indexes(&v_counts_down);
            for i in 0..count {
                let mut results_down_tmp = results_down.clone();
                while let Some(mut result_tmp) = results_down_tmp.pop() {
                    result_tmp.push(i);
                    results.push(result_tmp);
                }
            }
        }
    }
    results
}
fn permutation_groups_of_orbit_indexes ( v_counts : & Vec < usize > ) -> Vec < Vec < usize > > { let mut results : Vec < Vec < usize > > = vec ! [ ] ; if v_counts . len ( ) == 1 { results = ( 0 .. v_counts [ 0 ] ) . map ( | idx | vec ! [ idx ] ) . collect ( ) ; } else if v_counts . len ( ) > 1 { let mut v_counts_down = v_counts . clone ( ) ; if let Some ( count ) = v_counts_down . pop ( ) { let results_down : Vec < Vec < usize > > = permutation_groups_of_orbit_indexes ( & v_counts_down ) ; for i in 0 .. count { let mut results_down_tmp = results_down . clone ( ) ; while let Some ( mut result_tmp ) = results_down_tmp . pop ( ) { result_tmp . push ( i ) ; results . push ( result_tmp ) ; } } } } results }
Auxiliary function for create combination of permutations from multiple vectors
Auxiliary function for create combination of permutations from multiple vectors
v_counts
&Vec<usize>
v_counts
&Vec<usize>