Function lax::layout::transpose_over

source ·
pub fn transpose_over<T: Copy>(
    layout: MatrixLayout,
    from: &[T],
    to: &mut [T],
) -> MatrixLayout
Expand description

Out-place transpose for general matrix

§Examples

let layout = MatrixLayout::C { row: 2, lda: 3 };
let a = vec![1., 2., 3., 4., 5., 6.];
let mut b = vec![0.0; a.len()];
let l = transpose_over(layout, &a, &mut b);
assert_eq!(l, MatrixLayout::F { col: 3, lda: 2 });
assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);
let layout = MatrixLayout::F { col: 2, lda: 3 };
let a = vec![1., 2., 3., 4., 5., 6.];
let mut b = vec![0.0; a.len()];
let l = transpose_over(layout, &a, &mut b);
assert_eq!(l, MatrixLayout::C { row: 3, lda: 2 });
assert_eq!(b, &[1., 4., 2., 5., 3., 6.]);

§Panics

  • If input array sizes and layout size mismatch