pub fn sort_matrix(mat: &Array2<f64>, sort_col: ArrayView1<f64>) -> (Array2<f64>, Vec<usize>) {
    let mut enum_col = sort_col.iter().enumerate().collect::<Vec<(usize, &f64)>>();
    enum_col.sort_by(|a, &b| a.1.partial_cmp(b.1).unwrap_or(Less).reverse());
    let indices = enum_col.iter().map(|x| x.0).collect::<Vec<usize>>();
    (mat.select(Axis(0), indices.as_slice()), indices)
}
/// Utility function for sorting a matrix. used to sort cachegrind data by particular metric (descending)
Utility function for sorting a matrix. used to sort cachegrind data by particular metric (descending)
Utility function for sorting a matrix . used to sort cachegrind data by particular metric ( descending )
pub fn sort_matrix(mat: &Array2<f64>, sort_col: ArrayView1<f64>) -> (Array2<f64>, Vec<usize>) {
    let mut enum_col = sort_col.iter().enumerate().collect::<Vec<(usize, &f64)>>();
    enum_col.sort_by(|a, &b| a.1.partial_cmp(b.1).unwrap_or(Less).reverse());
    let indices = enum_col.iter().map(|x| x.0).collect::<Vec<usize>>();
    (mat.select(Axis(0), indices.as_slice()), indices)
}
pub fn sort_matrix ( mat : & Array2 < f64 > , sort_col : ArrayView1 < f64 > ) -> ( Array2 < f64 > , Vec < usize > ) { let mut enum_col = sort_col . iter ( ) . enumerate ( ) . collect :: < Vec < ( usize , & f64 ) > > ( ) ; enum_col . sort_by ( | a , & b | a . 1 . partial_cmp ( b . 1 ) . unwrap_or ( Less ) . reverse ( ) ) ; let indices = enum_col . iter ( ) . map ( | x | x . 0 ) . collect :: < Vec < usize > > ( ) ; ( mat . select ( Axis ( 0 ) , indices . as_slice ( ) ) , indices ) }
Utility function for sorting a matrix.
Utility function for sorting a matrix .
mat
&Array2<f64>
sort_col
ArrayView1<f64>
mat
&Array2<f64>
sort_col
ArrayView1<f64>