Function swap_rows
pub fn swap_rows<E>(a: RowMut<'_, E>, b: RowMut<'_, E>)where
E: ComplexField,
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::swap_rows};
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.as_mut().two_rows_mut(0, 2);
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);