Wrong number of rows / columns in nalgebra SMatrix generated from iterator

Viewed 26

The following code:

let m: SMatrix<f64, 2, 3> = SMatrix::from_iterator((1..).map(|x| x as f64));
println!("{:?}", m);

produces the following output:

[[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]

The matrix outputed has 3 rows, and each row has 2 columns. In the definition of the matrix however, I asked for 2 rows that each have 3 columns following the nalgebra documentation.

Expected output:

[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]

Did I misunderstand what the correct behaviour should be ? If not is this an issue from the nalgebra crate ?

0 Answers
Related