File: cs_matrix.rs

package info (click to toggle)
rust-nalgebra 0.33.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,340 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![cfg_attr(rustfmt, rustfmt_skip)]

use na::{Matrix4x5, Matrix5x4, CsMatrix};

#[test]
fn cs_transpose() {
    let m = Matrix4x5::new(
        4.0, 1.0, 4.0, 0.0, 9.0,
        5.0, 6.0, 0.0, 8.0, 10.0,
        9.0, 10.0, 11.0, 12.0, 0.0,
        0.0, 0.0, 1.0, 0.0, 10.0
    );

    let cs: CsMatrix<_, _, _> = m.into();
    assert!(cs.is_sorted());

    let cs_transposed = cs.transpose();
    assert!(cs_transposed.is_sorted());

    let cs_transposed_mat: Matrix5x4<_> = cs_transposed.into();
    assert_eq!(cs_transposed_mat, m.transpose())
}