On Tue, May 16, 2023 at 6:42 AM Marcin Błażejowski <marcin(a)wrzosy.nsb.pl> wrote:
Hi,
after some basic matrix modifications cols & rows name are gone? Is that
expected:
<script>
m = mnormal(3,3)
strings rownames = defarray("r1", "r2", "r3")
strings colnames = defarray("c1", "c2", "c3")
rnameset(m, rownames)
cnameset(m, colnames)
print m
print m'
print m[1:end-1, 1:end-1]
</script>
It's expected. We assume if you're slicing in both dimensions of a
matrix you don't care (much) about preserving names. In some cases you
may care, but there's a trade-off: I think in most cases we'd be
wasting CPU cycles subsetting and reattaching arrays of names. Now
that you can use a selection vector to slice an array it's easy enough
to preserve row or column naming if that's what you want.
Allin