Function lax::layout::square_transpose

source ·
pub fn square_transpose<T: Copy>(layout: MatrixLayout, a: &mut [T])
Expand description

In-place transpose of a square matrix by keeping F/C layout

Transpose for C-continuous array

let layout = MatrixLayout::C { row: 2, lda: 2 };
let mut a = vec![1., 2., 3., 4.];
square_transpose(layout, &mut a);
assert_eq!(a, &[1., 3., 2., 4.]);

Transpose for F-continuous array

let layout = MatrixLayout::F { col: 2, lda: 2 };
let mut a = vec![1., 3., 2., 4.];
square_transpose(layout, &mut a);
assert_eq!(a, &[1., 2., 3., 4.]);

§Panics

  • If size of a and layout size mismatch