dimforge / dimforge/nalgebra

Document the behaviors of Debug v.s. Display for Matrix

Open
#1,496 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

_Original title: Debug printing of Matrix looks transposed_

While looking into https://github.com/dimforge/nalgebra/issues/1495 I found that `std::fmt::Debug` is implemented for `Matrix` by simply delegating to its storage, which in same cases is eventually `[[T; R]; C]`. This gives a formatting that looks row-major, even though `Matrix` is supposed to to be column-major.

As a result:

```rust
let matrix = nalgebra::matrix!(
0, 1, 2;
10, 11, 12;
20, 21, 22;
);
println!("{matrix:?}");
```

Prints:
```
[[0, 10, 20], [1, 11, 21], [2, 12, 22]]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.