On 16/04/2026 02:16, Cottrell, Allin wrote:
OK, for those working with gretl git here's a little test script for
new functionality. Rownames are also supported, but not yet arrays of
matrices. This is not yet in the snapshots but that should happen
tomorrow.

<hansl>
set seed 765545431

matrix M = mnormal(4,3)
cnameset(M, "one two three")
print M

matrix c = M[,"two"]
print M c

rnameset(M, "a b c d")
eval M["c","two"]

matrices MM = defarray(M, I(3))
eval MM[1][,"three"]

bundle b = _(M)
eval b.M[,"three"]

matrix a = {1.5}
cnameset(a, "c1")
rnameset(a, "r1")
a
eval a["c1"]
eval a["r1"]

# and write mode

M[,"three"] = seq(1,4)'
M

MM[1][,"three"] = seq(1,4)'
eval MM[1][,"three"]
</hansl>

Thanks, Allin, this is very nice.

There is a more general point that IMO is worth considering. Suppose we're slicing a matrix with row/column names (via traditional methods or via this cool new feature). Should names be carried over to the resulting objects? To be more explicit (quoting from above):

<hansl>
set seed 765545431

matrix M = mnormal(4,3)
cnameset(M, "one two three")
matrix c = M[,"two"]
</hansl>

should the "c" vector be endowed with the column name "two" too? My spontaneous reaction would be "no" (on the grounds of efficiency), but others may disagree.

-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------