swap_rows_idx

Function swap_rows_idx 

Source
pub fn swap_rows_idx<M: Shape, N: Shape, T>(
    mat: MatMut<'_, T, M, N>,
    a: Idx<M>,
    b: Idx<M>,
)
Expand description

swaps the two rows at indices a and b in the given matrix

§panics

panics if either a or b is out of bounds

§example

use faer::{mat, perm};

let mut m = mat![
	[1.0, 2.0, 3.0], //
	[4.0, 5.0, 6.0],
	[7.0, 8.0, 9.0],
	[10.0, 14.0, 12.0],
];

perm::swap_rows_idx(m.as_mut(), 0, 2);

let swapped = mat![
	[7.0, 8.0, 9.0], //
	[4.0, 5.0, 6.0],
	[1.0, 2.0, 3.0],
	[10.0, 14.0, 12.0],
];

assert_eq!(m, swapped);