swap_cols

Function swap_cols 

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

swaps the values in the columns 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_cols_mut(0, 2);
perm::swap_cols(a, b);

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

assert_eq!(m, swapped);