On Tue, 1 Nov 2011, artur bala wrote: > Another point (which was my original one): the [column or row] > names are not saved when a matrix is returned from a function.
True. Here's a minimal case: <hansl> function matrix mnames (void) matrix m = I(3) colnames(m, "col1 col2 col3") print m return m end function matrix m = mnames() print m </hansl> Initially I thought this might be a simple bug that could easily be fixed, but actually it turns out it's a design issue (and hence I'm copying gretl-devel, hoping for comments). The point is that the gretl_matrix type knows nothing about column or row names. These names reside at the level of the "user_matrix" struct which wraps a locally named gretl_matrix for ease of use. But when a function returns a matrix, it returns a plain gretl_matrix: the names are destroyed and not returned. The main reason that the names are attached to the "user_matrix" wrapper and not the gretl_matrix itself is to keep the gretl_matrix type lean and mean. After all, it's used internally in many contexts where column/row names are never wanted, and it's also offered as a type for matrix operations by third parties (the libgretl API) where, again, name-pointers are likely to be just a deadweight. On the other hand, I can see a use-case for wanting to return a matrix from a user-defined function with row and/or column names attached. Right now, I'm not sure how to resolve this. Allin