Skip to content

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

@SimonSapin

Description

@SimonSapin

Original title: Debug printing of Matrix looks transposed

While looking into #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:

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]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions