This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adding support for pretty printing of 2D arrays


Hi, lately I have been working with the C++ Eigen [1] linear algebra
template library.
Naturally Eigen has data structures for Matrices. Currently when
pretty printing these the  content is shown in the following way.

A matrix

M = [1 2
     3 4]

would be pretty printed in the following way

[0,0] = 1, [0,1] = 2, [1,0] = 3, [1,1] = 4

which is better than the "array" pretty pretty printing hint which gives just

1 2 3 4

I would like to know if it makes sense to add 2D, and possibly a
n-dimensional, array pretty printing hint and logic?

If so I would like to invest some time to implement this.

The rationale behind such a feature is to simplify debugging numerical
code using data structures of the kind

struct matrix {
  int rows;
  int cols;
  double *data;
};

which, at least in my field, are very normal.

[1] http://eigen.tuxfamily.org/

Have a nice day! - Morten


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]