fn swap_rows<T>(A: &mut Array2<T>, idx_row1: usize, idx_row2: usize)
where
    T: NdFloat,
{
    // to swap rows, get two ArrayViewMuts for the corresponding rows
    // and apply swap elementwise using ndarray::Zip
    let (.., mut matrix_rest) = A.view_mut().split_at(Axis(0), idx_row1);
    let (row0, mut matrix_rest) = matrix_rest.view_mut().split_at(Axis(0), 1);
    let (_matrix_helper, mut matrix_rest) = matrix_rest
        .view_mut()
        .split_at(Axis(0), idx_row2 - idx_row1 - 1);
    let (row1, ..) = matrix_rest.view_mut().split_at(Axis(0), 1);
    Zip::from(row0).and(row1).for_each(std::mem::swap);
}
/// Swaps two rows of a matrix
Swaps two rows of a matrix
Swaps two rows of a matrix
fn swap_rows<T>(A: &mut Array2<T>, idx_row1: usize, idx_row2: usize)
where
    T: NdFloat,
{
    // to swap rows, get two ArrayViewMuts for the corresponding rows
    // and apply swap elementwise using ndarray::Zip
    let (.., mut matrix_rest) = A.view_mut().split_at(Axis(0), idx_row1);
    let (row0, mut matrix_rest) = matrix_rest.view_mut().split_at(Axis(0), 1);
    let (_matrix_helper, mut matrix_rest) = matrix_rest
        .view_mut()
        .split_at(Axis(0), idx_row2 - idx_row1 - 1);
    let (row1, ..) = matrix_rest.view_mut().split_at(Axis(0), 1);
    Zip::from(row0).and(row1).for_each(std::mem::swap);
}
fn swap_rows < T > ( A : & mut Array2 < T > , idx_row1 : usize , idx_row2 : usize ) where T : NdFloat , { // to swap rows, get two ArrayViewMuts for the corresponding rows // and apply swap elementwise using ndarray::Zip let ( .. , mut matrix_rest ) = A . view_mut ( ) . split_at ( Axis ( 0 ) , idx_row1 ) ; let ( row0 , mut matrix_rest ) = matrix_rest . view_mut ( ) . split_at ( Axis ( 0 ) , 1 ) ; let ( _matrix_helper , mut matrix_rest ) = matrix_rest . view_mut ( ) . split_at ( Axis ( 0 ) , idx_row2 - idx_row1 - 1 ) ; let ( row1 , .. ) = matrix_rest . view_mut ( ) . split_at ( Axis ( 0 ) , 1 ) ; Zip :: from ( row0 ) . and ( row1 ) . for_each ( std :: mem :: swap ) ; }
Swaps two rows of a matrix
Swaps two rows of a matrix
A
&mut Array2<T>
idx_row1
usize
idx_row2
usize
A
&mut Array2<T>
idx_row1
usize
idx_row2
usize