Choose rows/columns from a WithFormat expression
Submitted by tim..@..il.com
Assigned to Nobody
Link to original bugzilla bug (#423)
Description
This is just a convenience request. I often want to print matrices with different headers for each row, something like
controls : <matrix row 1>
gradients : <matrix row 2>
I can do this by printing each row separately
cout << "controls : " << Mat.row(0) << endl
<< "gradients : " << Mat.row(1) << endl;
But then the columns are not aligned. Even if I use an IOFormat object for each row, the columns are not aligned properly if the maximum element size in each row is not equal. It would be convenient if we could call block operations like row or col on WithFormat expressions, something like
cout << "controls : " << Mat.format(fmt).row(0) << endl
<< "gradients : " << Mat.format(fmt).row(1) << endl;
which would align the columns properly. I think this could also be solved (I'm guessing easier for the developers) by having a parameter in IOFormat which specifies the field width, instead of just the number of significant digits. Also, with a field width parameter, it would be possible to correctly align separate matrices or vectors without concatenating them into one large matrix.
Thanks.