[go: up one dir, main page]

Make the sparse matrix printer pretty

What does this implement/fix?

This makes the operator<< for sparse matrices have a fixed width.

Consider the matrix:

 2.00  0.00  0.00
 0.50  1.66  0.00
 0.50 -0.15  1.31

When I print this using the current operator<< it looks like this:

2.00 0 0
0.50 1.66 0
0.50 -0.15 1.31

My fix to this operator enforces a variable width so that it would look like this:

 2.00  0.00  0.00
 0.50  1.66  0.00
 0.50 -0.15  1.31

Now it actually looks pretty 😁 . The dense matrix printer (print_matrix) does something similar, though the implementation is different.

Merge request reports

Loading