swap_rows

Function swap_rows 

Source
pub fn swap_rows<N: Shape, T>(a: RowMut<'_, T, N>, b: RowMut<'_, T, N>)
Expand description

swaps the values in the rows a and b

§panics

panics if a and b don’t have the same number of columns

§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],
];

let (a, b) = m.two_rows_mut(0, 2);
perm::swap_rows(a, b);

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);